title: Reverse proxy NGINX front-end to redirect Dockerized Apache
body: <p>I am coming from <a href="https://stackoverflow.com/questions/57389327/nginx-does-not-load-css-and-js-of-docker-containers">this</a>. I am new in web-servers. I am setting up a server (example.de) serving several dockerized applications. One of them (app3) is running on behind an Apache server (port 80 inside the container mapped to 8484). I want to use a NGINX docker container to redirect the url example.de/app3 to example.de:8484. Other two applications will be also redirected to example.de/app?. 
  When I request the url example.de:8484 it works fine. However, when I use example.de/app3 only the "It works" webpage appears.</p>
  
  <p>The docker-compose file is something similar to:</p>
  
  <pre><code>version: '3'
  services:
      app3:
          build:
              context: app3
          container_name: app3
  
      app3_apache:
          build:
              context: app3/apache
          container_name: app3_apache
          ports:
              - "8484:80"
          volumes:
              - vol_app3:/vol/app3
          depends_on:
              - app3
          links:
              - app3
  
      nginx-proxy:
        container_name: nginx
        build:
          context: nginx/
        ports:
          - "80:80"
        depends_on:
          - app3_apache
        links:
          - app3_apache
        volumes:
          - vol_nginx:/etc/nginx/conf.d
  
  volumes:
      vol_app3:
          driver_opts:
              type: none
              device: /vol/app3
              o: bind
      vol_nginx:
          driver_opts:
              type: none
              device: /vol/nginx
              o: bind
  </code></pre>
  
  <p>NGINX default.conf file looks like:</p>
  
  <pre><code>server {
      listen 80;
      listen [::]:80;
      server_name example.de;
  
      location /app3 {
        proxy_pass http://app3_apache:80;
      }
  }
  </code></pre>
  
  <p>Additional information:
  It creates and run the containers. The webpage in the APACHE container is served  in the NGINX container using the xxx.xxx.xxx.xxx:80 but not app3_apache:80 <code>&lt;h1&gt;Bad Request (400)&lt;/h1&gt;</code>.</p>
  
  <p>I can reach the app3_apache container from the NGINX container:</p>
  
  <pre><code>traceroute app3_apache
  traceroute to app3_apache (xxx.xxx.xxx.xxx), 30 hops max, 60 byte packets
   1  app3_apache.server_default (xxx.xxx.xxx.xxx)  0.351 ms  0.054 ms  0.035 ms
  </code></pre>