BirgerK / docker-apache-letsencrypt

This docker-image contains a simple Apache webserver and supports https-encryption by great Let's Encrypt certificates!
68 stars 47 forks source link

Adding a domain result in "unable to find port 80" #12

Closed Joohansson closed 4 years ago

Joohansson commented 4 years ago

I can't figure out how to use this. I've tried to start the docker with and without the DOMAINS env variable. I get this:

docker exec -it apache-ssl /run_letsencrypt.sh --domains ""

Using Let's Encrypt Production environment...
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for <mydomain.com>
Cleaning up challenges
Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80.
BirgerK commented 4 years ago

You have to provide and mount virtual host files: https://httpd.apache.org/docs/2.4/vhosts/examples.html

Joohansson commented 4 years ago

Ok but mount where? Using the predefined volumes or like a bind mount. It's not in your readme how to do that. How will apache know the name of my config file? Please explain. I'm a bit new to docker.

BirgerK commented 4 years ago

The docker image uses a standard apache web-server. So this is a apache thing.

Apache expects its vhosts under /etc/apache2/sites-enabled.

For further apache questions please consider stackoverflow or google.

Joohansson commented 4 years ago

Ok that was not super clear reading your description. I had to do a bunch of stuff to get it up and running. I think you should give an example at least for people like me.

docker cp test.conf apache-ssl:/etc/apache2/sites-available
docker exec -it apache-ssl a2ensite test.conf
docker exec -it apache-ssl mkdir /var/www/test
<copy actual web data to /var/www/test>
docker exec -it apache-ssl service apache2 reload
docker exec -it apache-ssl /run_letsencrypt.sh --domain "example.com"