Skip to content

Instantly share code, notes, and snippets.

@hpcorona
Last active December 10, 2015 20:03
Show Gist options
  • Save hpcorona/de6e58ee43c86b62b0c4 to your computer and use it in GitHub Desktop.
Save hpcorona/de6e58ee43c86b62b0c4 to your computer and use it in GitHub Desktop.
Nginx Configuration for HTTP
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html;
# Make site accessible from http://localhost/
server_name localhost;
location / {
try_files $uri @proxy;
}
location @proxy {
proxy_pass http://localhost:9000;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto http;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location /web/ {
root /var/www/html;
index index.html;
expires 7d;
if ($request_uri ~* \.nocache\.(html|js|gif)$) {
add_header Last-Modified "{now} GMT";
add_header Cache-Control "no-cache, no-store, must-revalidate, max-age=0";
add_header Cache-Control "post-check=0, pre-check=0";
add_header Pragma no-cache;
expires -1d;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment