wmnnd / nginx-certbot

Boilerplate configuration for nginx and certbot with docker-compose
MIT License
3.16k stars 1.17k forks source link

Where shall I put the html content ? #43

Closed danielporto closed 5 years ago

danielporto commented 5 years ago

Sorry if this is a super dumb question but I failed to find where shall i put the html pages... I tried on ./data/certbot/www after generating the certificates.

When I try to open in the browser it fails with "try to clean your cookies". I tried with 3 different web browsers and in incognito mode. When I use curl to https site I get a 301 site moved permanently. I reviewed all files, even carefully compared with the git repo... Do you have any idea what's going on? Site scores A at SSL Labs test anyways... but no webpage is shown.

rafaeljpc commented 5 years ago

Hello,

Any progress for this issue?

tx

SoltauFintel commented 5 years ago

Here's my solution:

Go to the folder where's your docker-compose.yml file

- .:/usr/share/nginx/html Add this line to the 1st volumes section of docker-compose.yml. Use the right indent.

echo "letsencrypt nginx works" > index.html

cd data/nginx

Edit 2nd server section of app.conf. First, remove the proxy_pass line.

root /usr/share/nginx/html; Second, add this line. Save app.conf.

cd ../..

docker-compose down (if necessary)

docker-compose up -d

Now call https://yourdomain.com/index.html in your browser. Works.

Troubleshooting

Use "docker logs {nginx-container-name}" to find the problem or use "docker exec -it {nginx-container-name} /bin/sh" to go into the running container and look for the files.

wmnnd commented 5 years ago

Hey @danielporto & @rafaeljpc: Thank you for your question. The /data/certbot/www folder is only used by certbot and you should not put your own content in there if you want to serve static files. The idea here is to modify app.conf and replace the bit that is a proxy_pass to example.org with your own configuration. You could either modify the proxy_pass directive to proxy a locally running server or you add your local folder as a volume to docker-compose.yml and then configure nginx to serve those files.