Issue
I have a jenkins and sonarqube container running on a server. Is it possible to use Nginx to connect to each under the same domain name? So for example my.domain.com/jenkins hits the jenkins container and my.domain.com/sonar hits sonarqube?
My initial guess at the setup is something like this.
server {
listen 80;
server_name my.domain.com;
location /sonar {
proxy_pass http://sonarqube:9000/;
}
location /jenkins {
proxy_pass http://jenkins:8080/;
}
}
This issues I keep running into involve the subsequent calls made after the initial page. Is there a way to keep the /sonar/ and /jenkins/ piece in all the calls made?
Solution
You need to make those applications aware of the different context, so that they generate links correctly. For Jenkins you need to specify --prefix=/jenkins
when starting Jenkins, for SonarQube you need to set up environment variable SONAR_WEB_CONTEXT=/sonar
when starting SonarQube.
See:
- https://www.jenkins.io/doc/book/installing/initial-settings/
- https://docs.sonarqube.org/latest/setup/environment-variables/#header-2
Answered By - raspy