I am trying to run Jenkins behind nginx. Jenkins runs in a Docker container, listening on Port 8080 from directory /jenkins. My nginx container has this Jenkins container linked as hostname "jenkins", so in its context, Jenkins is accessible via http://jenkins:8080/jenkins.
I followed the steps at Running Jenkins from a folder with TLS encryption and thus my site-config
contains this:
location ^~ /jenkins/ {
sendfile off;
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_pass http://jenkins:8080/jenkins/;
proxy_redirect http:// https://;
proxy_max_temp_file_size 0;
client_max_body_size 64m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
I am now trying to access the nginx from localhost, and calling https://localhost/jenkins presents me Jenkins. However, when I go to "Manage Jenkins", I get the message that my reverse proxy setup is incorrect. I tried
curl -k -iL -e https://localhost/jenkins/manage \
https://localhost/jenkins/administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/test
which gives me a 404 with http://localhost/jenkins/manage vs. https:
.
When I add
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header X-Forwarded-Ssl on;
the message changes to https://localhost/jenkins/manage vs. https:
What am I missing?