Certbot Apache error “Name duplicates previous WSGI daemon definition.”

It turns out that if my Apache conf file 000-default.conf only declares <VirtualHost *:80>...</VirtualHost>, then Certbot duplicates it and creates a second Apache conf file called 000-default-le-ssl.conf to define <VirtualHost *:443>...</VirtualHost>.

The Name duplicates previous WSGI daemon definition error appears because both Apache conf files have the same line defining WSGIDaemonProcess myprocess.... This appears to be a known Certbot bug.

The workaround I’ve found is to define both VirtualHosts (80 and 443) in the same Apache conf file (so that Certbot doesn’t create a second file), and to define WSGIDaemonProcess outside both VirtualHosts, like this:

WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess myprocess user=ubuntu group=ubuntu threads=10 home=/home/ubuntu/myapp
WSGIProcessGroup myprocess

<VirtualHost *:80>
    ServerName example.com
    ...
</VirtualHost>
<VirtualHost *:443>
    ServerName example.com
    ...
</VirtualHost>

Leave a Comment