title: letsencrypt webroot gives 404 for nginx located in docker
body: <p>I have a simple docker container run in the following way:</p>
  
  <pre><code>docker service create --name nginx_proxy \
    --mount type=bind,source=/opt/nginx/conf.d,target=/etc/nginx/conf.d \
    --mount type=bind,source=/opt/nginx/webroot,target=/var/webroot \
    --constraint 'node.role==manager' \
    --publish 80:80 --publish 443:443 \
    --network nginx-net \
    nginx
  </code></pre>
  
  <p>The created service runs without issues. I added a sample configuration that proxy passes to another service in the same network (example.com.conf):</p>
  
  <pre><code>server {
    listen 80;
    server_name example.com www.example.com;
    location /.well-known/acme-challenge {
      alias /var/webroot;
    }
  
    location / {
      proxy_pass http://example_site:8080;
    }
  }
  </code></pre>
  
  <p>When I go to (www.)example.com, I can see my website.</p>
  
  <p>Since I mounted host:/opt/nginx/webroot to container:/var/webroot, I created a file in /opt/nginx/webroot called "test.html" (contents of the file do not matter).</p>
  
  <p>When I open my browser and type in:</p>
  
  <pre><code>http://example.com/.well-known/acme-challenge/test.html
  </code></pre>
  
  <p>I can view the file that I added to /opt/nginx/webroot. However, certbot throws 404 when I run the following command:</p>
  
  <pre><code>certbot certonly --dry-run --webroot -w /opt/nginx/webroot -d example.com -d www.example.com
  </code></pre>
  
  <p>What am I missing here? To my understanding, certbot creates a file in webroot directory and tries to download the file publicly; however, it doesn't see my file for some reason.</p>