Unable to forward port 80 to my SonarQube Web Server using Apache

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): SonarQube v10.0.0.68432 Community Edition. No extensions or plugins used.

  • how is SonarQube deployed: zip, Docker, Helm : I’m deploying it with the sonarqube-10.0.0.68432.zip downloaded directly from the SonarQube website. I’m also using Centos 7 as my environment.

  • what are you trying to achieve: I’m trying to forward port 80 to my SonarQube webserver hosted on port 8080 using apache on Centos 7. This way I can just type my server IP to access the webserver rather than <server-ip>:8080/sonarqube/

  • what have you tried so far to achieve this: I’ve gone through my /etc/httpd/conf/httpd.conf file and setup a reverse proxy as such

ProxyRequests Off
ProxyPreserveHost On
<VirtualHost *:80>
  ServerName <server-ip>
  ProxyPass / http://<server-ip>:8080/sonarqube/
  ProxyPassReverse / <server-ip>:8080/sonarqube/
</VirtualHost>

When I access my server-ip at port 80 through the web browser, I get a page that just says “loading…” in plain html. I can access my web server directly at <server-ip>:8080/sonarqube/.

Hey there.

Have you configured sonar.web.context in your conf/sonar.properties file?

yes I have it set to " /sonarqube "

Here is what I get when opening my access.log
image

Hey there.

I think that if you want to serve SonarQube over /sonarqube/, you’ll need to adjust your configuration:

  ProxyPass /sonarqube http://<server-ip>:8080/sonarqube/
  ProxyPassReverse /sonarqube <server-ip>:8080/sonarqube/

It gives me the default landing page for apache when adjusting my configuration to that. Here’s what my configuration is at right now:

<VirtualHost *:80>
  ServerName <server-ip>
  ProxyPass /sonarqube http://<server-ip>:8080/sonarqube/
  ProxyPassReverse /sonarqube <server-ip>:8080/sonarqube/
  ErrorLog /opt/sonarqube/logs/webservererror.log
  CustomLog /opt/sonarqube/logs/webserveraccess.log common
</VirtualHost>

Hi,

i’ve attached my httpd.conf (Apache runs on Windows Server 2019),
maybe it helps

httpd.conf.txt (2.0 KB)

Gilbert