Last active
August 29, 2015 14:08
-
-
Save vishaltelangre/b22b570287e8615ed825 to your computer and use it in GitHub Desktop.
nginx proxy pass (e.g. from port 80 to 8080)
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
upstream http_backend { | |
server 127.0.0.1:8080; | |
keepalive 32; | |
} | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
server { | |
listen 80; | |
server_name example.com; | |
access_log /var/log/example_com_access.log; | |
error_log /var/log/example_com_error.log; | |
location / { | |
proxy_pass http://http_backend; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $connection_upgrade; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
more_clear_headers 'X-Frame-Options'; | |
} | |
location /static/ { | |
alias /var/www/example.com/current/static/; | |
add_header Access-Control-Allow-Origin *; | |
gzip_static on; | |
expires max; | |
add_header Cache-Control public; | |
more_clear_headers 'X-Frame-Options'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment