Our server administrator installed via Certbot the free Let's Encrypt certificate on our server with FreeBSD. But the cert doesn't work and we can't understand how exaclty we should configure the file /usr/local/etc/apache24/httpd.conf
and/or /usr/local/etc/apache24/extra/httpd-vhosts.conf
?
We use virtual hosts to host a few websites at the server. And the directory with websites is /usr/local/www/apache24/
Should we duplicate <VirtualHost>
for the domain but with the port :443
?
How in SSH to check whether the cert is working?
EDIT
I've just run the command certbot --apache -d example.com
, but now if I open the website I get the 502 Bad Gateway error.
Here is our updated httpd-vhosts.conf
:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot "/usr/local/www/apache24/public_html"
SSLEngine on
<Directory "/usr/local/www/apache24/public_html">
Options -Indexes
Order allow,deny
Allow from all
AllowOverride All
Require all granted
</Directory>
SSLCertificateFile /usr/local/etc/letsencrypt/live/example.com-0001/fullchain.pem
SSLCertificateKeyFile /usr/local/etc/letsencrypt/live/example.com-0001/privkey.pem
Include /usr/local/etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
I see that Apache stopped working. If I try to run service apache24 start
I get the error
Address already in use: make_sock: could not bind to address
0.0.0.0:443