question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

503 Service Temporarily Unavailable (Tried all the methods but still failed)

See original GitHub issue

Hi, I am trying to use the nginix-proxy to expose the different containers to use the same port 80 for external connection.

I tried to follow the standard suggestion in https://cloud.google.com/community/tutorials/nginx-reverse-proxy-docker

Step 1:

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

Step 2:

docker run -d --name site-a -e VIRTUAL_HOST=a.example.com nginx

However, I kept got the error “503 Service Temporarily Unavailable” when accessing “example.com” and

“This site can’t be reached a.example.com’s server IP address could not be found.” when accessing “a.example.com”

Following

https://github.com/jwilder/nginx-proxy/issues/582#issuecomment-249425260

I tried to

docker run -d -p 80:80 -e DEFAULT_HOST=a.example.com -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy:latest

Still cannot make it.

Following https://github.com/jwilder/nginx-proxy/issues/749

I tried to use the docker compose

version: '2'

services:

  blog:
    image: wordpress 
    container_name: wordpress
    environment:
      - VIRTUAL_HOST=blog.robota.asia
    expose:
      - "80"
    restart: always

  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro

networks:
  default:
    external:
      name: nginx-proxy

but same error remains, this is really quite frustrating, can anyone help on this?

This is what I see from the logs of the proxy container:

dockergen.1 | 2018/10/24 04:42:01 Received event die for container 66b3131df8e6 dockergen.1 | 2018/10/24 04:42:01 Generated ‘/etc/nginx/conf.d/default.conf’ from 1 containers dockergen.1 | 2018/10/24 04:42:01 Running ‘nginx -s reload’ dockergen.1 | 2018/10/24 04:42:01 Received event stop for container 66b3131df8e6 dockergen.1 | 2018/10/24 04:42:01 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ‘nginx -s reload’ dockergen.1 | 2018/10/24 04:42:09 Received event start for container 83c86489b047 dockergen.1 | 2018/10/24 04:42:09 Generated ‘/etc/nginx/conf.d/default.conf’ from 2 containers dockergen.1 | 2018/10/24 04:42:09 Running ‘nginx -s reload’ dockergen.1 | 2018/10/24 04:42:09 Error running notify command: nginx -s reload, exit status 1 dockergen.1 | 2018/10/24 04:42:09 2018/10/24 04:42:09 [emerg] 33#33: no host in upstream “:80” in /etc/nginx/conf.d/default.conf:59

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:22 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
gavingcommented, Feb 12, 2020

I narrowed this issue down to this block in /etc/nginx/conf.d/default.conf (at my end anyway):-

https://github.com/jwilder/nginx-proxy/blob/master/nginx.tmpl#L140

server {
	server_name _; # This is just an invalid value which will never trigger on a real hostname.
         .....
}

Before my other server stuff.

Removing the block allowed things to behave as I’d expect, but I’m at a loss why or how to remove this section without hacking the tmpl file and passing it in.

2reactions
kimrazcommented, Nov 5, 2019

Same issue here. Adding the “depends_on” parameter didn’t help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

503 Service Unavailable Error: What It Is and How to Fix It
A 503 Service Unavailable Error is an HTTP response status code indicating that a server is temporarily unable to handle the request.
Read more >
503 Service Unavailable Error Message: What It Is and How to ...
The 503 Service Unavailable error is an HTTP status code meaning a website's server is not available right now, usually due to a...
Read more >
How to Fix the HTTP Error 503 Service Unavailable - Kinsta
The 503 (Service Unavailable) status code indicates that the server is currently unable to handle the request due to a temporary overload or ......
Read more >
HTTP Error 503 Service Unavailable Explained - freeCodeCamp
A 503 Service Unavailable error means that the page or resource is unavailable. There are many reasons why a server might return a...
Read more >
What Is a 503 Service Unavailable Error (and How to Fix It)
The error 503 Service Unavailable message typically indicates a temporary problem. Sometimes all it takes to clear the error code is to press...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found