-
-
Save renius/5133645 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
upstream backend { | |
server 127.0.0.1:3000 fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name mydomain.com; | |
root /path/to/project/public; | |
access_log off; | |
# GZIP compression | |
gzip on; | |
gzip_min_length 1000; | |
gzip_comp_level 3; | |
gzip_types text/plain text/css text/javascript application/x-javascript application/json; | |
gzip_proxied any; | |
gzip_vary on; | |
# Performance & connectivity optimizations | |
tcp_nodelay on; | |
keepalive_timeout 600s; | |
# Ignored URLs | |
location ~ null { return 404; } | |
location ~ google-analytics\.com/ga\.js { return 404; } | |
location ~ avg_ls_dom\.js { return 404; } | |
location / { | |
error_page 405 = /system/maintenance.html; | |
try_files $uri /system/maintenance.html @backend; | |
} | |
location ~* /(assets|system) { | |
expires 1y; | |
add_header Cache-Control public; | |
gzip_static on; | |
open_file_cache max=1000 inactive=600s; | |
open_file_cache_valid 600s; | |
open_file_cache_errors on; | |
try_files $uri =404; | |
} | |
location @backend { | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_redirect off; | |
proxy_pass http://backend; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment