Attempt to issue a cert broke apache config

I attempted to issue a cert on a website. I issued the command:

sudo ./certbot-auto -d mydomain.com

I was asked if I wanted to always redirect HTTP to HTTPS and selected yes - I’m pretty sure this was my mistake (as there was already a working config set up). The server uses both apache and nginx. After running the command, apache will not start and I’m pretty sure the problem is this from the output:

Added an HTTP->HTTPS rewrite in addition to other RewriteRules; you may wish to check for overall consistency. Redirecting vhost in /etc/apache2/sites-available/mydomain.conf to ssl vhost in /etc/apache2/sites-available/mydomain.com-le-ssl.conf

I’m pretty sure this has injected something I don’t want to have in my apache config which is causing a port conflict as apache will not start with the message:

AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1. Set the ‘ServerName’ directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address 127.0.0.1:443
no listening sockets available, shutting down

Now I’m no apache expert so the question is, what would have been injected into the config that I should delete to get it back to how it was before?

In short, since running that command I cannot run both apache and nginx at the same time.

I ended up having to use kill to kill some nginx process. After that apache started up OK.

It sounds like (before you ran certbot-auto) Apache used one port and nginx used the other (80 & 443) and now Apache is using both ports.
If that is the case, you may need to check the config dates to see which were modified and hopefully restore them back as they were before you ran certbot.

This hasn't corrected the problem permanently as nginx is still configured to use port 443 and will attempt to do so at the next reboot. If it does so before Apache can you will have the same problem again.
And even if Apache does so first, whatever the reason nginx was listening on port 443 has been completely discarded and most likely not properly addressed.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.