Skip to content

Instantly share code, notes, and snippets.

@alvin2ye
Created January 16, 2018 02:50
Show Gist options
  • Save alvin2ye/5f3fbd71f364d2b3cea937f33748d0b7 to your computer and use it in GitHub Desktop.
Save alvin2ye/5f3fbd71f364d2b3cea937f33748d0b7 to your computer and use it in GitHub Desktop.
nginx_3000_to_80.conf
gzip on;
gzip_vary on;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_min_length 1000;
gzip_proxied any;
gzip_disable "msie6";
gzip_http_version 1.0;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
upstream app_backend {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name _;
root /app/public;
client_max_body_size 0;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location /frontend_wechat/ {
try_files $uri $uri/index.html /frontend_wechat/index.html;
}
location /frontend_admin/ {
try_files $uri $uri/index.html /frontend_admin/index.html;
}
try_files $uri/index.html $uri @app;
location @app {
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $http_x_real_ip;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://app_backend;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment