Created
March 16, 2013 12:59
-
-
Save tolleiv/5176269 to your computer and use it in GitHub Desktop.
Sample config to have a Nginx as reverse proxy with a fallback host included
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 tracker { | |
server localhost:81; | |
server localhost:82 backup; | |
} | |
# HTTP server | |
server { | |
listen 80 default; | |
location / { | |
proxy_pass http://tracker; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Forwarded-Host http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header HTTPS ""; | |
proxy_hide_header Via; | |
} | |
} | |
# HTTPS server | |
server { | |
listen 443; | |
ssl on; | |
ssl_certificate cert.pem; | |
ssl_certificate_key cert.key; | |
ssl_session_timeout 5m; | |
ssl_protocols SSLv3 TLSv1; | |
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP; | |
ssl_prefer_server_ciphers on; | |
location / { | |
proxy_pass http://tracker; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Forwarded-Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header HTTPS "on"; | |
proxy_hide_header Via; | |
} | |
} | |
# Backup host | |
server { | |
listen 127.0.0.1:82; | |
root /usr/share/nginx/www; | |
index index.html index.htm; | |
location / { | |
try_files $uri $uri/ /index.html; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment