Search code examples
nexussonatype

Sonatype Nexus: is it possible to add a redirect url configutaion in jetty.xml?


Currently I have Sonatype Nexus running on Jetty server. My nexus is available at the url: http://example.com/nexus. Just wondering if is it possible to redirect the requests that comes to http://example.com to http://example.com/nexus?

Thank you so much for the help!!!!


Solution

  • The Jetty settings are controlled in the Nexus properties file:

    • $NEXUS_HOME/conf/nexus.properties

    Try changing the nexus-webapp-context-path property to "/" and restart Nexus:

    # Jetty section
    application-port=8081
    application-host=0.0.0.0
    nexus-webapp=${bundleBasedir}/nexus
    nexus-webapp-context-path=/nexus
    
    # Nexus section
    nexus-work=${bundleBasedir}/../sonatype-work/nexus
    runtime=${bundleBasedir}/nexus/WEB-INF
    

    A better alternative would be to setup a reverse proxy for Nexus, using either Apache or Nginx. This avoids the need to run Nexus as root (in order to bind to port 80).