Skip to content

Instantly share code, notes, and snippets.

@scottwb
Created July 2, 2010 03:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scottwb/460906 to your computer and use it in GitHub Desktop.
Save scottwb/460906 to your computer and use it in GitHub Desktop.
Nginx config for Hudson CI behind a reverse proxy with SSL.
# 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.example.com/;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment