I have never experienced CentOS but I had the same issue with Ubuntu
Problem:
I wanted to make my nginx to
so that I can access jenkins with my own host under https://my-host/jenkins
I did lots of online digging and the majority of the answers were adding "--prefix=/jenkins"
to JENKINS_ARGS
in /etc/default/jenkins
file, then restart jenkins service. But this solution didn't work for me.
Spent hours of more research and tries, I finally made it work with this solution.
Solution:
nginx side:
#etc/nginx/sites-available/default
location /jenkins/ {
proxy_pass HTTP://localhost:1234/jenkins/;
...
}
jenkins side:
Major Credit: Jihed Hmida & Priit:
Jenkins changes in /etc/default/jenkins not working
after jenkins 2.332.1.. the /etc/default/jenkins is no longer used. jenkins is now configured with systemd. you can check systemctl cat jenkins to see the options and systemctl edit jenkins to modify it..
To set prefix arg '/jenkins' to jenkins service, you have to add Environment="JENKINS_PREFIX=/jenkins"
to sudo systemctl edit jenkins
You can also see many other options in sudo systemctl cat jenkins
Don't forget to restart both nginx and jenkins services :)