Skip to content

Instantly share code, notes, and snippets.

@uZer
Last active December 21, 2015 05:19
Show Gist options
  • Save uZer/6256309 to your computer and use it in GitHub Desktop.
Save uZer/6256309 to your computer and use it in GitHub Desktop.
Nginx configuration file for a webserver 'proxy', redirecting by default all the HTTP / HTTPS requests to the <webServerIP>. The redirection is effective with any domain name, and preserves the name for the <webServerIP>'s vhost configuration.
## HTTP
server {
listen 80 default_server;
access_log /var/log/nginx/default.http.access.log;
location / {
proxy_pass http://<webServerIP>;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
## HTTPS
server {
listen 443 default_server;
access_log /var/log/nginx/default.https.access.log;
ssl on;
ssl_certificate /etc/nginx/ssl/wildcard.pem;
ssl_certificate_key /etc/nginx/ssl/wildcard.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://<webServerIP>;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment