title: Nginx docker compose - volume add nginx.conf (reverse proxy)
body: <p>I want to containerize my web applications. Currently, I am using <strong>Apache</strong> to provide a couple of <strong>PHP</strong> apps.</p>
  <p>Every app should be provided by their own container.
  Nginx should be reachable by <strong>port 80/443</strong>. Depending on the sub route it should proxying to one of the containers.</p>
  <p><strong>For example:</strong></p>
  <pre><code>www.url.de/hello1 --&gt; hello1:80
  www.url.de/hello2 --&gt; hello2:80
  </code></pre>
  <p><strong>docker-compose.yml:</strong></p>
  <pre><code>version: '3'
  services:
      nginx:
              image: nginx:latest
              container_name: reverse_proxy
              volumes:
                      - ./nginx.conf:/etc/nginx/nginx.conf
              ports:
                      - &quot;80:80&quot;
                      - &quot;443:443&quot;
              networks:
                      - app-network
              depends_on:
                      - hello1
                      - hello2
  
      hello1:
              build: ./test1
              image: hello1
              container_name: hello1
              expose:
                      - &quot;80&quot;
              networks:
                      - app-network
      hello2:
              build: ./test2
              image: hello2
              container_name: hello2
              expose:
                      - &quot;80&quot;
              networks:
                      - app-network
  
  networks:
      app-network:
  </code></pre>
  <p><strong>nginx.conf:</strong></p>
  <pre><code>events {
  
  }
  
  http {
      error_log /etc/nginx/error_log.log warn;
      client_max_body_size 20m;
  
      proxy_cache_path /etc/nginx/cache keys_zone=one:500m max_size=1000m;
  
  
      server {
              server_name wudio.de;
  
              location / {
                      proxy_pass http://hello1:80;
              }
  
              location /hello1/ {
                      proxy_pass http://hello1:80;
                      rewrite ^/hello1(.*)$ $1 break;
              }
  
              location /hello2/ {
                      proxy_pass http://hello2:80;
                      rewrite ^/hello2(.*)$ $1 break;
              }
  
      }
  }
  </code></pre>
  <p>If I run <strong>docker-compose up -d</strong>, only the container with image <strong>webapp-test1</strong> is online. And I also can reach it by <code>curl localhost:8081</code>.
  Nginx is not running. If I remove the line in which I add <strong>nginx.conf</strong> to the volume of Nginx, it´s working.
  What I´m doing wrong?</p>
  <p><strong>Edit1:</strong></p>
  <pre><code>http:// was missing. But proxying still not working on subroutes. Only location / is working. How I get /hell1 running?
  </code></pre>