Can't log in after using nginx as a reverse proxy, prompting that I can't connect to the server


#1

Can’t log in after using nginx as a reverse proxy, prompting that I can’t connect to the server

Operation failed as server could not be contacted

server {
listen 80;
server_name localhost;

    # allow large uploads of files
    client_max_body_size 1G;

    # optimize downloading files larger than 1G
    # proxy_max_temp_file_size 2G;

    location /nexus {
        # Use IPv4 upstream address instead of DNS name to avoid attempts by nginx to use IPv6 DNS lookup
        proxy_pass http://192.168.14.129:8081/;
        #proxy_set_header Host $host;
        proxy_set_header Host $host:$proxy_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

#2

The web context path Nexus is running on needs to match the web context path it is served through in nginx. Edit $workdir/etc/nexus.properties and set:

nexus-context-path=/nexus

And change the proxy_pass to be:

proxy_pass http://192.168.14.129:8081/nexus;

Rich