Skip to content

Instantly share code, notes, and snippets.

@taicki
Created August 1, 2011 20:27
Show Gist options
  • Save taicki/1118913 to your computer and use it in GitHub Desktop.
Save taicki/1118913 to your computer and use it in GitHub Desktop.
upstream streamer {
server 192.168.1.139:443;
}
# HTTPS server
#
server {
listen 443;
server_name woodstock;
# access_log /var/log/nginx/ssl_access.log;
# error_log /var/log/nginx/ssl_error.log;
ssl on;
ssl_certificate /etc/nginx/ssl-cert.pem;
ssl_certificate_key /etc/nginx/ssl-cert.key;
location / {
proxy_pass https://streamer;
proxy_redirect off;
# nginx specific header
proxy_set_header X-Real-IP $remote_addr;
# de-facto standard header for proxy
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# overwrite the original hostname
proxy_set_header Host $host;
}
}
# To see X-Forwarded-For in Apache's log
# e.g) LogFormat "%h %l %u %t \"%r\" %>s %b \"%{X-Forwarded-For}i\""
# References
# - http://www.cyberciti.biz/faq/howto-linux-unix-setup-nginx-ssl-proxy/
# - http://en.wikipedia.org/wiki/X-Forwarded-For
# - http://wiki.nginx.org/HttpProxyModule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment