-
-
Save rrrodrigo/461254 to your computer and use it in GitHub Desktop.
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
# Nginx config for Hudson CI behind a virtual host with SSL. | |
# Replace hudson.example.com with your domain name. | |
# Upstream Hudson server, e.g.: on port 3001 | |
upstream hudson { | |
server localhost:3001 | |
} | |
# Redirect all HTTP requests to HTTPS. | |
server { | |
listen 80; | |
server_name hudson.example.com; | |
location / { | |
rewrite ^ https://hudson.example.com$request_uri? permanent; | |
} | |
} | |
# Proxy HTTPS requests on hudson.example.com to localhost Hudson server. | |
server { | |
listen 443; | |
server_name hudson.example.com; | |
ssl_on; | |
ssl_certificate /etc/pki/tls/certs/hudson_example_com.pem; | |
ssl_certificate_key /etc/pki/tls/certs/hudson_example_com.pem; | |
ssl_session_cache shared:SSL:1m; | |
ssl_session_timeout 5m; | |
# Only allow GET, HEAD, and POST requests. | |
if ($request_method !~ ^(GET|HEAD|POST)$ ) { | |
return 444; | |
} | |
location / { | |
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 https; | |
proxy_set_header Host $http_host; | |
proxy_next_upstream error; | |
proxy_pass http://hudson; | |
proxy_redirect http://hudson.example.com/ https://hudson.strings.com/; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment