Skip to content

Instantly share code, notes, and snippets.

@lidio601
Created October 14, 2016 07:10
Show Gist options
  • Save lidio601/aa97397f8cdb5f405ce770dde2fe3c2b to your computer and use it in GitHub Desktop.
Save lidio601/aa97397f8cdb5f405ce770dde2fe3c2b to your computer and use it in GitHub Desktop.
Nginx SSL Proxy configuration to bridge with
#
# Nginx SSL Proxy
# @link https://gist.github.com/lidio601/aa97397f8cdb5f405ce770dde2fe3c2b
# @link https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-with-ssl-as-a-reverse-proxy-for-jenkins
#
# Redirect all HTTP requests to SSL
server {
listen 80;
return 301 https://$host$request_uri;
}
# SSL Proxy definition
server {
listen 443;
server_name $host;
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;
ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://example.com:80;
proxy_read_timeout 90;
proxy_redirect http://example.com:80 https://$host;
}
error_page 404 /error/404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /error/50x.html;
location = /error/50x.html {
root /usr/share/nginx/html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment