Created
April 15, 2018 22:06
-
-
Save mgrahamjo/fbf242dddb86e809d61c048a2e96b529 to your computer and use it in GitHub Desktop.
Basic nginx sites-available conf for node reverse proxy + gzipped static files; external https rewrites assumed (i.e. cloudflare)
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
server { | |
server_name example.com; | |
return 301 https://example.com$request_uri; | |
} | |
server { | |
listen [::]:80; | |
listen 80; | |
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/javascript text/xml application/xml application/xml+rss text/javascript; | |
gzip_buffers 16 8k; | |
sendfile on; | |
keepalive_timeout 65; | |
server_name example.com; | |
location ~* ^.+\.(jpg|jpeg|gif|png|svg|ico|css|js)$ { | |
root /home/app/example.com/dist; | |
access_log off; | |
expires max; | |
} | |
location / { | |
proxy_pass http://<IP_ADDRESS>:8080; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment