Last active
September 15, 2018 15:23
-
-
Save likidu/10249876 to your computer and use it in GitHub Desktop.
Nginx Settings for NodeJS App
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
# Nginx Reverse Proxy for NodeJS Apps | |
server | |
{ | |
listen 80; | |
server_name wechat.io; | |
index index.html index.htm index.php default.html default.htm default.php; | |
root /home/wwwroot/wechat.io; | |
include none.conf; | |
if ($http_host != "wechat.io") { | |
rewrite ^ http://wechat.io$request_uri permanent; | |
} | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $remote_addr; | |
proxy_set_header Host $host; | |
proxy_pass http://127.0.0.1:3456; | |
} | |
location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|woff)$ { | |
add_header Pragma public; | |
add_header Cache-Control "public, mustrevalidate, proxy-revalidate"; | |
proxy_pass http://127.0.0.1:3456; | |
} | |
location ~ .*\.(php|php5)?$ | |
{ | |
try_files $uri =404; | |
fastcgi_pass unix:/tmp/php-cgi.sock; | |
fastcgi_index index.php; | |
include fcgi.conf; | |
} | |
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ | |
{ | |
expires 30d; | |
} | |
location ~ .*\.(js|css)?$ | |
{ | |
expires 12h; | |
} | |
access_log off; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment