server { server_name gocd.forksand.com; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name gocd.forksand.com; # managed by Certbot location / { # try_files $uri $uri/ =404; # Proxy everything over to the GoCD server 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_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_pass http://localhost:8153/; # To be able to upload artifacts larger than default size of 1mb, ensure that you set this up to a large value. # setting to `0` will disable checking for body size. # See https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size client_max_body_size 10000m; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/gocd.forksand.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/gocd.forksand.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { if ($host = gocd.forksand.com) { return 301 https://$host$request_uri; } # managed by Certbot listen 80 ; server_name gocd.forksand.com; return 404; # managed by Certbot }