'Reverse Nginx work with one config/location but with second not

this is my following setup

raspberry pi as (home) server port-forwording 443 from rooter to my pi reverse-nginx on the pi and listen to 443 and forward the requests to my services (docker-applications) using noip for a ddns-name for my public-ip so i can access my pi/reverse-proxy over the ddns-name

I have 3 docker-images nginx(reverse-proxy), owncloud and nexus.

I will access my owncloud over the internet via the ddns-name/owncloud and my nexus via ddns-name/nexus. I have two *.conf-files for my reverse-nginx one for owncloud and one for nexus.

See the folowing files

owncloud config

upstream owncloud {
  server        192.168.0.155:8080;
}

server {
  listen       443 ssl http2;

  include /etc/nginx/ssl.conf;

  location /owncloud {
    proxy_pass   http://owncloud;
    include      common_location.conf;
  }
}

nexus config

upstream nexus {
  server        192.168.0.155:8081;
}

server {
  listen       443 ssl http2;

  include /etc/nginx/ssl.conf;

  location /nexus {
    proxy_pass   http://nexus;
    include      common_location.conf;
  }
}

If i only activate the owncloud-config without the nexus-config, all working correct. I can access my owncloud on the pi over the internet with ddns-name/owncloud over https.

If both configs are active (owncloud and nexus) only nexus works over ddns-name/nexus. If I try to accessing ddns-name/owncloud I get an 404 not found.

I have no idea why this is not working. I'm not so familiar with nginx and try out much tutorials but nothing helps. I think I missed something :)

Hope anyone can help me.

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source