Last active
December 31, 2015 05:39
-
-
Save huanglong-zz/7942002 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /usr/local/etc/nginx/nginx.conf | |
user nobody; | |
#worker_processes 2; | |
error_log /usr/local/etc/nginx/log/nginx/error.log warn; | |
#pid /usr/local/etc/nginx/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
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"'; | |
access_log /usr/local/etc/nginx/log/nginx/access.log main; | |
sendfile on; | |
#tcp_nopush on; | |
keepalive_timeout 65; | |
gzip on; | |
include /usr/local/etc/nginx/conf.d/*.conf; | |
} | |
# /usr/local/etc/nginx/conf.d/xx.conf | |
# the IP(s) on which your node server is running. I chose port 4000. | |
upstream www { | |
server 127.0.0.1:4000; | |
} | |
server { | |
listen 0.0.0.0:80; | |
server_name www xx.com www.xx.com localhost; | |
#charset koi8-r; | |
access_log /usr/local/etc/nginx/log/xx.access.log main; | |
# Gzip Compression | |
gzip on; | |
gzip_comp_level 6; | |
gzip_vary on; | |
gzip_min_length 1000; | |
gzip_proxied any; | |
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
gzip_buffers 16 8k; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_pass http://www; | |
proxy_redirect off; | |
#root /usr/share/nginx/html; | |
#index index.html index.htm; | |
} | |
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ { | |
root /Users/black/Projects/xx/public; | |
} | |
#error_page 404 /404.html; | |
# redirect server error pages to the static page /50x.html | |
# | |
#error_page 500 502 503 504 /50x.html; | |
#location = /50x.html { | |
# root /usr/share/nginx/html; | |
#} | |
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 | |
# | |
#location ~ \.php$ { | |
# proxy_pass http://127.0.0.1; | |
#} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
#location ~ \.php$ { | |
# root html; | |
# fastcgi_pass 127.0.0.1:9000; | |
# fastcgi_index index.php; | |
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; | |
# include fastcgi_params; | |
#} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
# | |
#location ~ /\.ht { | |
# deny all; | |
#} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment