Certbot Apache 错误“名称重复了先前的 WSGI 守护进程定义." [英] Certbot Apache error "Name duplicates previous WSGI daemon definition."
问题描述
在我的 Ubuntu 16.04 服务器上,我在 /etc/apache2/sites-enabled/000-default.conf
中有一个 Apache conf 文件,它看起来像这样(缩写):
On my Ubuntu 16.04 server, I have an Apache conf file at /etc/apache2/sites-enabled/000-default.conf
, which looks like this (abbreviated):
WSGIApplicationGroup %{GLOBAL}
<VirtualHost *:80>
ServerName example.com
WSGIDaemonProcess myprocess user=ubuntu group=ubuntu threads=10 home=/home/ubuntu/myapp
WSGIProcessGroup myprocess
...
</VirtualHost>
它在 HTTP 模式下工作正常,但是当我运行 $ sudo certbot --apache
来设置 HTTPS 时,它失败并出现错误 Syntax error on line 7 of/etc/apache2/sites-enabled/000-default.conf:名称与之前的 WSGI 守护进程定义重复.
第 7 行是以 WSGIDaemonProcess
开头的行.
It works fine in HTTP mode, but when I run $ sudo certbot --apache
to set up HTTPS, it fails with the error Syntax error on line 7 of /etc/apache2/sites-enabled/000-default.conf: Name duplicates previous WSGI daemon definition.
Line 7 is the line beginning with WSGIDaemonProcess
.
推荐答案
事实证明,如果我的 Apache conf 文件 000-default.conf
only 声明 <VirtualHost *:80>...</VirtualHost>
,然后 Certbot 复制它并创建一个 second Apache conf 文件,名为 000-default-le-ssl.conf
来定义
.
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>
.
出现Name duplicates previous WSGI daemon definition
错误是因为两个 Apache conf 文件具有定义WSGIDaemonProcess myprocess...
的同一行.这似乎是一个已知的 Certbot 错误.
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.
我发现的解决方法是在相同Apache conf文件中定义两个VirtualHosts(80和443)(这样Certbot就不会创建第二个文件),并在两个 VirtualHosts 之外定义 WSGIDaemonProcess
,如下所示:
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>
这篇关于Certbot Apache 错误“名称重复了先前的 WSGI 守护进程定义."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!