tomcatfedoranexusport80

How to run nexus sonatype on port 80?


I have a fedora server. I installed tomcat via yum package manager. Then I deployed the nexus war on the webapps folder. I tryed using jsvc to run the server on port 80 and did not work. I saw you can also use port fowarding. What is the best alternative ?

edit 1: httpd

I followed 3.8. Running Nexus Behind a Proxy from sonatype doc and I'm a bit confused. I installed httpd, and I have the following configuration, where example.com is my domain.

/etc/httpd/conf.d/nexus.conf

NameVirtualHost *:80

<VirtualHost *:80>

  ServerName example.com
  ProxyRequests Off

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyPass /nexus/ http://localhost:8081/nexus/
  ProxyPassReverse /nexus/ http://localhost:8081/nexus/
  ProxyPreserveHost On

  <Location />
    Order allow,deny
    Allow from all
  </Location>

  ErrorLog logs/nexus/error.log
  CustomLog logs/nexus/access.log common
</VirtualHost>

/home/guillaume/www/nexus/conf

# 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
pr.encryptor.publicKeyPath=/apr/public-key.txt

when I try to access

any clue on how to make that proxy work ?

edit 2: nginx

I found the error, the dns was wrong: nslookup example.com resolved to x.x.x.x when my ip was x.x.x.y

but I did enjoy ngix configuration

server {

        listen 80;
        server_name example.com;

        access_log off;
        error_log off;

        location / {
                proxy_pass      http://localhost:8081;
                proxy_redirect  off;

                #Proxy Settings
                proxy_set_header   Host             $host;
                proxy_set_header   X-Real-IP        $remote_addr;
                proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }

        # would be a good idea to redirect static assets
}

Solution

  • I don't like running java app servers on port 80. Requires the process to be run as root.

    The best approach is to install Apache (or Nginx) and configure nexus as a reverse proxy. For more details on how this is done I'd suggest reading the relevent section of the Nexus book:

    Note