Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section helps you configure Sonar SonarQubeTM if you want to run Sonar it behind a proxy. This can be done for security concerns or to consolidate multiple disparate applications.

Info
titleTable of Contents

Table of Contents

 

Running

...

SonarQubeTM behind an Apache Proxy

We assume that you've already installed Apache 2 with module mod_proxy, that Sonar SonarQubeTM is running and available on http://privates_sonar_host:sonar_port/ and that you want to configure a Virtual Host for www.public_sonar.com.

At this point, edit the HTTPd configuration file for the www.public_sonar.com virtual host. Include the following to expose Sonar SonarQubeTM via mod_proxy at http://www.public_sonar.com/:

Code Block
ProxyRequests Off
ProxyPreserveHost On
<VirtualHost *:80>
  ServerName www.public_sonar.com
  ServerAdmin admin@somecompany.com
  ProxyPass / http://private_sonar_host:sonar_port/
  ProxyPassReverse / http://www.public_sonar.com/
  ErrorLog logs/somecompany/sonar/error.log
  CustomLog logs/somecompany/sonar/access.log common
</VirtualHost>

If the url of the Sonar SonarQubeTM server must have a context like http://www.public_sonar.com/sonar_context, in that case the following line must be uncommented in the sonar.properties configuration file to prevent using the Apache mod_rewrite:

...

Apache configuration is going to vary based on your own application's requirements and the way you intend to expose Sonar SonarQubeTM to the outside world. If you need more details about Apache HTTPd and mod_proxy, please see http://httpd.apache.org.

Running

...

SonarQubeTM behind Nginx

We assume that you've already installed Nginx, that you are using a Virtual Host for www.somecompany.com and that Sonar SonarQubeTM is running and available on http://sonahost:sonarport/.

At this point, edit the Nginx configuration file. Include the following to expose Sonar SonarQubeTM at http://www.somecompany.com/ :

Code Block
# the server directive is nginx's virtual host directive
server {
  # port to listen on. Can also be set to an IP:PORT
  listen 80;

  # sets the domain[s] that this vhost server requests for
  server_name www.somecompany.com;

  location / {
    proxy_pass http://sonarhost:sonarport;
  }
}

Nginx configuration is going to vary based on your own application's requirements and the way you intend to expose Sonar SonarQubeTM to the outside world. If you need more details about Nginx, please see http://nginx.org.