Last active
May 28, 2024 16:25
-
-
Save badsyntax/8455064 to your computer and use it in GitHub Desktop.
Revisions
-
badsyntax revised this gist
Jan 24, 2014 . 1 changed file with 11 additions and 11 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,18 @@ server { listen YOUR_IP_ADDRESS:80 default_server; root /var/www/nginx; index index.html index.htm; # This is just an invalid value which will never trigger on a real hostname. server_name _; server_name_in_redirect off; location / { # First attempt to serve request as file, then # as directory, then fall back to index.html try_files $uri $uri/ /index.html; } } -
badsyntax revised this gist
Jan 24, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,7 @@ server { # client_max_body_size 16M; # Change access and error log files. access_log /home/richard/www/logs/domain.tld-nginx.log; location / { # Set this to your upstream module. -
badsyntax created this gist
Jan 16, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ server { listen YOUR_IP_ADDRESS:80 default_server; root /var/www/nginx; index index.html index.htm; # This is just an invalid value which will never trigger on a real hostname. server_name _; server_name_in_redirect off; location / { # First attempt to serve request as file, then # as directory, then fall back to index.html try_files $uri $uri/ /index.html; } } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ # The upstream module is the link between Node.js and Nginx. # Upstream is used for proxying requests to other servers. # All requests for / get distributed between any of the servers listed. upstream app_domain.tld { server 127.0.0.1:3001 max_fails=0 fail_timeout=10s weight=1; # Send visitors back to the same server each time. ip_hash; # Enable number of keep-alive connections. keepalive 512; } server { listen YOUR_IP_ADDRESS:80; # Index files. index index.html; server_name domain.tld; # Timeout for closing keep-alive connections. keepalive_timeout 10; # Enable gzip compression. gzip on; gzip_http_version 1.1; gzip_vary on; gzip_comp_level 6; gzip_proxied any; gzip_buffers 16 8k; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; # Max upload size. # client_max_body_size 16M; # Change access and error log files. access_log /home/richard/www/logs/domain.tld-nginx.log; location / { # Set this to your upstream module. proxy_pass http://app_domain.tld; # Proxy headers. proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-NginX-Proxy true; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_cache_bypass $http_upgrade; proxy_http_version 1.1; proxy_redirect off; # Go to next upstream after if server down. proxy_next_upstream error timeout http_500 http_502 http_503 http_504; proxy_connect_timeout 5s; # Gateway timeout. proxy_read_timeout 20s; proxy_send_timeout 20s; # Buffer settings. proxy_buffers 8 32k; proxy_buffer_size 64k; } # Serve static files without going through upstreams location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|flash/|media/|static/|robots.txt|humans.txt|favicon.ico) { root /home/richard/www/sites/domain.tld/public; access_log off; expires 1h; } }