nginx-proxy: 503 when running as per README

I ran the following commands

docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy

docker run -d --expose 8080 -e VIRTUAL_HOST=*.ip-51-254-138.eu -v /home/ops/compliant-elm:/content -e STATIC_DIR="/content" -e ES_URI="http://51.254.138.217:9200" compliant-rest

I get this from my laptop

➜  ~ curl http://217.ip-51-254-138.eu/
<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body bgcolor="white">
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx/1.9.15</center>
</body>
</html>

This is what ended up on the nginx container

root@c99fd3cff62e:/app# cat /etc/nginx/conf.d/default.conf
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
# scheme used to connect to this server
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
  default $http_x_forwarded_proto;
  ''      $scheme;
}
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
# Connection header that may have been passed to this server
map $http_upgrade $proxy_connection {
  default upgrade;
  '' close;
}
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
log_format vhost '$host $remote_addr - $remote_user [$time_local] '
                 '"$request" $status $body_bytes_sent '
                 '"$http_referer" "$http_user_agent"';
access_log off;
# HTTP 1.1 support
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
server {
    server_name _; # This is just an invalid value which will never trigger on a real hostname.
    listen 80;
    access_log /var/log/nginx/access.log vhost;
    return 503;
}
upstream *.ip-51-254-138.eu {
}
server {
    server_name *.ip-51-254-138.eu;
    listen 80 ;
    access_log /var/log/nginx/access.log vhost;
    location / {
        proxy_pass http://*.ip-51-254-138.eu;
    }
}

If I run cat /var/log/nginx/access.log it just freezes

I checked in here, I thought from reading some of these issues there might be a vhosts.d dir?

root@c99fd3cff62e:/app# ls /etc/nginx/
certs  conf.d  fastcgi_params  koi-utf  koi-win  mime.types  modules  nginx.conf  scgi_params  uwsgi_params  win-utf

What am I doing wrong?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 16

Most upvoted comments

@blockmurder what i think is missing is that your nginx-proxy and wordpress service container needs to share a common network. One way is to create a network with docker network create nginx-proxy etc connect nginx-proxy to it and then use something like this for your wordpress service:

version: '2'
services:
  wordpress:
    ... cut ...
    networks:
     - default
     - nginx-proxy

networks:
  nginx-proxy:
    external:
      name: nginx-proxy