If you installed Nexus as a stand-alone application, Nexus is running on a high-performance servlet container based on Java NIO. From a performance perspective, there is no reason for you not to run Nexus by itself without a proxy. Yet, more often than not, organizations run applications behind a proxy for security concerns and to consolidate multiple disparate applications using tools like mod_rewrite. For this reason, we’ve included some brief instructions for configuration Apache httpd. We assume that you’ve already installed Apache 2, and that you are using a Virtual Host for www.somecompany.com.
Let’s assume that you wanted to host Nexus behind Apache HTTPd at the URL http://www.somecompany.com. To do this, you’ll need to change the context path that Nexus is served from.
- Edit nexus.properties in $NEXUS_HOME/conf. You’ll see an element named nexus-webapp-context-path. Change this value from "/nexus" to "/"
- Restart Nexus and Verify that it is available on http://localhost:8081/
- Clear the Base URL in Nexus as shown in Figure 6.8, “Administration Application Server Settings” under Application Server Settings.
At this point, edit the HTTPd configuration file for the www.somecompany.com virtual host. Include the following to expose Nexus via mod_proxy at http://www.somecompany.com/
ProxyRequests Off ProxyPreserveHost On <VirtualHost *:80> ServerName www.somecompany.com ServerAdmin admin@somecompany.com ProxyPass / http://localhost:8081/ ProxyPassReverse / http://localfhost:8081/ ErrorLog logs/somecompany/nexus/error.log CustomLog logs/somecompany/nexus/access.log common </VirtualHost>
If you just wanted to continue to serve Nexus at the /nexus context path, you would not change the nexus-webapp-context-path in and you would include the context path in your ProxyPass and ProxyPassReverse
ProxyPass /nexus/ http://localhost:8081/nexus/ ProxyPassReverse /nexus/ http://localhost:8081/nexus/
Apache configuration is going to vary based on your own application’s requirements and the way you intend to expose Nexus to the outside world. If you need more details about Apache httpd and mod_proxy, please see http://httpd.apache.org