Repository Management with Nexus
The Nexus installation bundle is based on the high-performance servlet container Eclipse Jetty running the Nexus web application. This achieves a very high performance of Nexus and make installation of a separate proxy for performance improvements unnecessary.
However in many cases organizations run applications behind a proxy for security concerns, familiarity with securing a particular proxy server or to consolidate multiple disparate applications using tools like mod_rewrite.
Some brief instructions for establishing such a setup with Apache httpd follow as an example. 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.4, “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 firstname.lastname@example.org 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/
If you want to serve Nexus on a context path that is different than the one it has been configured for you will also need to add a ProxyPassReverseCookiePath.
ProxyPass /nexus http://localhost:8081/ ProxyPassReverse /nexus http://localfhost:8081/ ProxyPassReverseCookiePath /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