caddy-docker-proxy: Not working?
Hello,
I have been searching for something like this for a long time as it seems like it will be perfect to meet my needs, if I can get it to work.
I have a few docker containers that are websites with one of them the main website and the other sub-domain websites that work with the main site.
I followed the example and started up the
caddy/docker-compose.yml
then I went into whoami/docker-compose.yml
and changed the “example.com” parts to a domain that I own. Let’s just call it “test.com” for these purposes and which is just a simple nginx web server with static pages.
version: '3.7'
services:
whoami:
image: jwilder/whoami
networks:
- caddy
labels:
caddy: whoami.test.com
caddy.reverse_proxy: " {{upstreams 8000}} "
networks:
caddy:
external: true
Saved it as whoami/docker-compose.yml and started that one up with docker compose as well.
Then I tried to go to the website.
but nothing seems to be happening and I get the message “This site can’t be reached” message which seems to indicate that there is no web server answering.
Can you please give me a bit of guidance and help on this?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 25 (4 by maintainers)
@lonnietc I’ve just read nginx doc again. Don’t try
server_name _;
as I mentioned above. Try changing:to:
I think this should fix your problem. Maybe you always access nginx using localhost and it works, that’s why you have the impression your nginx config was right. It only fails when you access it from a different domain.
https://stackoverflow.com/questions/9454764/nginx-server-name-wildcard-or-catch-all