Skip to content

Instantly share code, notes, and snippets.

@likidu
Last active September 15, 2018 15:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save likidu/10249876 to your computer and use it in GitHub Desktop.
Save likidu/10249876 to your computer and use it in GitHub Desktop.
Nginx Settings for NodeJS App
# 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