Skip to content

Instantly share code, notes, and snippets.

@abdul
Created September 4, 2016 09:54
Show Gist options
  • Save abdul/6c8b44eafc851c5ea580b8f96ab14c53 to your computer and use it in GitHub Desktop.
Save abdul/6c8b44eafc851c5ea580b8f96ab14c53 to your computer and use it in GitHub Desktop.
Teamcity (with WebSockets) - Nginx with SSL
map $http_upgrade $connection_upgrade {
default upgrade;
'' '';
}
server {
listen 80;
server_name teamcity.local;
rewrite ^ https://$host$request_uri? permanent;
}
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/letsencrypt/live/teamcity.local/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/teamcity.local/privkey.pem;
ssl_session_timeout 30m;
server_name teamcity.local;
client_max_body_size 0;
client_header_buffer_size 50M;
proxy_read_timeout 1200;
proxy_connect_timeout 240;
access_log /var/log/nginx/teamcity-access.log;
error_log /var/log/nginx/teamcity-error.log;
location / {
proxy_pass http://localhost:8111/;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
#proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment