martmaiste / nginx-certbot

Nginx reverse proxy with Let's Encrypt support
9 stars 8 forks source link

502 Bad Gateway when running container #2

Open xAlstrat opened 5 years ago

xAlstrat commented 5 years ago

Hello !

I tried to run nginx-certbot but I get an 502 error on https://localhost (redirections from http to https works):

docker pull martmaiste/nginx-certbot
docker run -d --name nginx -p 80:80 -p 443:443 \
       -e DOMAIN=localhost \
       -e EMAIL=hostmaster@localhost \
       --net=host \
       -t martmaiste/nginx-certbot

I'm missing something? Also I tried to use this as image build for my project with no success, just like this:

FROM martmaiste/nginx-certbot
COPY build/ /usr/share/nginx/html

Thanks you so much !

martmaiste commented 5 years ago

Default nginx.conf sets it up as a reverse proxy for your web-server on port 8080. If there is nothing listening on this port then you get 503 - bad gateway as expected. To use it as a standalone web-server you need to modify your nginx.conf accordingly. Remove proxy lines from the location / section and add a root /usr/share/nginx/html;