Skip to content

Instantly share code, notes, and snippets.

@vancouverwill
Last active July 11, 2016 14:52
Show Gist options
  • Save vancouverwill/0f025f0024c9421c28cf0a04bcf9ca7f to your computer and use it in GitHub Desktop.
Save vancouverwill/0f025f0024c9421c28cf0a04bcf9ca7f to your computer and use it in GitHub Desktop.
Sample NGINX configuration for redirect proxy server
user nginx;
worker_processes 1;
events { worker_connections 1024; }
http {
sendfile on;
server {
listen 443 ssl;
#servername localhost;
client_max_body_size 20m;
client_header_timeout 1200;
client_body_timeout 1200;
send_timeout 1200;
keepalive_timeout 1200;
ssl_certificate dummy.cert;
ssl_certificate_key dummy.cert.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
# openssl req -new -newkey rsa:2048 -nodes -keyout dummy.cert.key -out dummy.csr
# sudo openssl x509 -req -days 365 -in dummy.csr -signkey dummy.cert.key -out dummy.cert
access_log /var/log/nginx/access.log combined;
error_log /var/log/nginx/error.log warn;
# this is the important part for the proxy server, instead of serving a local applicatin I am are redirecting all traffic to a different instance
location / {
proxy_pass https://xx.xx.xx.xx:443;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment