how to enable SSL for both jenkins and sonarqube running on the same server


I have installed jenkins and sonarqube in the same server. Jenkins is running on port 8080 and sonarqube is running on port 9000.

I want to enable SSL for both jenkins and sonarqube using the same DNS name.

I have the apache config as below

<VirtualHost *:80>
  ProxyRequests Off
  ProxyVia On
  Redirect permanent /

<VirtualHost *:443>

  SSLEngine On
  SSLProxyEngine On
  SSLCertificateFile    /etc/apache2/ssl/crt/
  SSLCertificateKeyFile /etc/apache2/ssl/key/

  ProxyRequests     Off
  ProxyPass         /  http://localhost:8080/
  ProxyPassReverse  /  http://localhost:8080/

  ProxyPass        /sonar http://localhost:9000/sonar
  ProxyPassReverse /sonar http://localhost:9000/sonar

RequestHeader set X_FORWARDED_PROTO "https"
  RequestHeader set X-Forwarded-Port "443"
  SetEnv force-proxy-request-1.0 1
  SetEnv proxy-nokeepalive 1

  <Proxy *>
   Order allow,deny
    Allow from all
  ProxyPreserveHost on

When i browse, jenkins log i page opens wit the following URL which is as expected.

But when i browse , i get the URl as, which gets the jenkins login page, but the expected should that when i browse i should get the sonarqube login page

Could you please let me know what configs that iam missing out?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Try switching the order of the ProxyPass directives like so:

  ProxyRequests     Off
  ProxyPass        /sonar http://localhost:9000/sonar
  ProxyPassReverse /sonar http://localhost:9000/sonar

  ProxyPass         /  http://localhost:8080/
  ProxyPassReverse  /  http://localhost:8080/

Per it appears that Apache checks them in the order that they are specified in. / matches everything so that might be why sonar requests are also getting proxied to Jenkins.