Search code examples
dockernginxnexusnginx-config

Nexus3 stuck on initializing and not properly resolving content-type


I am running Nexus3 in a docker container on a server that also uses nginx reverse-proxy. The problem is that when try to access to nexus repository from a browser, I am getting a broken page that has many console errors. Here's what I see: console errors

After looking at the network tab, I noticed that my server is not setting the proper content-type for my requests. This is an example of a request to a js file: js file request

Does anyone know what this could be? This is what my nginx.conf looks like:

server {
        listen 443 ssl http2;
        ssl_certificate /etc/ssl/confidential.com/fullchain.cer;
        ssl_certificate_key /etc/ssl/confidential.com/*.confidential.com.key;
        server_name confidential.com;

    location /test {
      proxy_pass http://nexus:8081/;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto "https";
    }



    }

Solution

  • You have:

    location /test {
          proxy_pass http://nexus:8081/;
    

    The context path of Nexus needs to match the context path served through the reverse proxy. Edit $workdir/etc/nexus.properties and set "nexus-context-path=/test". And change the proxy_pass to be "proxy_pass http://nexus:8081/test".