Skip to content

Instantly share code, notes, and snippets.

@zafranf
Forked from petemcw/01-README.md
Created April 14, 2018 14:51
Show Gist options
  • Save zafranf/3b1f9f81c28078f6ea10e6584d0bf5a0 to your computer and use it in GitHub Desktop.
Save zafranf/3b1f9f81c28078f6ea10e6584d0bf5a0 to your computer and use it in GitHub Desktop.
Mac OS X LEMP Configuration
----------------------------------------------------------------------
# http://wiki.nginx.org/NginxMainModule
#----------------------------------------------------------------------
user prm staff;
worker_processes 2;
pid /usr/local/var/run/nginx/nginx.pid;
#----------------------------------------------------------------------
# http://wiki.nginx.org/NginxEventsModule
#----------------------------------------------------------------------
events {
worker_connections 1024;
accept_mutex off;
}
#----------------------------------------------------------------------
# http://wiki.nginx.org/NginxHttpCoreModule
#----------------------------------------------------------------------
http {
access_log /usr/local/var/log/nginx/access.log;
error_log /usr/local/var/log/nginx/error.log warn;
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# This tells Nginx to ignore the contents of a file it is sending
# and uses the kernel sendfile instead
sendfile on;
# Set this to on if you have sendfile on
# It will prepend the HTTP response headers before
# calling sendfile()
tcp_nopush on;
# This disables the "Nagle buggering algorithm" (Nginx Docs)
# Good for websites that send a lot of small requests that
# don't need a response
tcp_nodelay on;
# timeouts
keepalive_timeout 25;
send_timeout 30;
# general options
charset utf-8;
server_tokens off;
server_name_in_redirect off;
ignore_invalid_headers on;
recursive_error_pages on;
merge_slashes on;
underscores_in_headers on;
limit_conn_zone $binary_remote_addr zone=limit_per_ip:16m;
types_hash_max_size 2048;
server_names_hash_bucket_size 128;
client_max_body_size 24m;
client_body_buffer_size 128k;
#proxy_read_timeout 18000;
# compression
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_vary on;
gzip_static on;
gzip_min_length 1024;
gzip_buffers 32 8k;
gzip_comp_level 6;
gzip_types text/plain text/css application/x-javascript text/comma-separated-values text/xml application/xml application/xml+rss application/atom+xml text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
# PHP-FPM
upstream phpfpm {
#server unix:/usr/local/var/run/nginx/phpfpm.sock;
server 127.0.0.1:9000;
}
# include active sites
include /usr/local/etc/nginx/sites-enabled/*;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment