2

I have a website running where I use Nginx Proxy Manager to redirect to this website. However, as soon as I hit my website I get the following message:

enter image description here

Does anyone have a clue what is happening here?

2
  • Possible cause: specifying localhost instead of the docker compose service name, in the "Forward Hostname / IP" field. Commented Dec 10, 2024 at 15:01
  • That was indeed the cause for me. Specifying the container/Docker compose service name won't be enough though, since NPM sits in its own separated Docker network. See my answer below for how to solve this networking issue. Commented Apr 24 at 14:18

2 Answers 2

0

Finally, I came to the following conclusion. I think from my experience it can mean two things:

  • Either your website/docker container is not running
  • Or Nginx cannot find an index.html file on the main root of web address 'example.com'.

However, hostinger.com points out the following:

  • Unresolved domain name
  • Server overload
  • Browser issues
  • Home-network equipment error
  • Firewall blocks

So make sure that index.html is present for your website and you have trouble shooted your container where you are 100% sure that docker container has no exceptions, errors and runs perfectly fine. Try use something like 'docker-compose logs' where the docker-compose.yml is located (this only works for a running docker container)

Sign up to request clarification or add additional context in comments.

Comments

0

Had the same error!

I've put posted my solution under the question nginx docker container: 502 bad gateway response, because it goes for Nginx run via Docker as well and is more easily found there.

My solution is about when your destination services/apps are also containerized.
But at the bottom I show how to solve this, when your destinations are not containers.

In a nutshell

Problem

Nginx (Proxy Manager) - run as Docker container - has its own network!

  • You can't forward to localhost, because that's the NPM container itself!

  • You also can't reach the host machine, because that's outside of its network.

Here's a good explanation with visualization.

Solution

  • put the Nginx Proxy Manager on the host network (by defining network_mode: host in its docker-compose.yml -> that's awkward, because now you can't control the port forwarding to that anymore (you can straight up delete the ports section)

  • [RECOMMENDED] put the NPM and all your services/apps/websites (which must all be containerized too, for this to work!) on one shared network!
    -> I show how to implement this here in my other post

8 Comments

Don't crosspost the same answer to multiple questions. If you consider the same solution applies to multiple questions, flag/close them as duplicates.
I removed the content from the other answer, with only a little summary/pointer to this answer here. Just for people looking for the Node Proxy Manager and all-Docker solution to find this. Thanks for pointing it out! It would really be bad practice to duplicate answers.
Changed my mind and moved the content to the other answer, because the solution goes for classic Nginx run via Docker as well and is more easily found over there.
Aren't these still the same answer to the same question? If the questions are the same vote to close them as duplicate. Do we really need both of these answers?
I've further improved this post, so this is just a summary with full details and code instructions in the other place.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.