Linux

certbot 無法辨識添加的 VirtualHost

  • July 22, 2020

我正在嘗試使用 certbot 為執行 nextcloud 的 http 伺服器獲取證書(raspi 上的archarm)。當我執行:$ sudo certbot --apache時,我得到:

$ sudo certbot --apache      
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
No names were found in your configuration files. Please enter in your domain
name(s) (comma and/or space separated)  (Enter 'c' to cancel): 

然後我輸入我的域:example.duckdns.org我得到:

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for example.duckdns.org
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.

雖然我確實有example_duckdns.conf其中的/etc/httpd/conf/extra樣子:

<Directory /var/www/html/nextcloud>
   Require all granted
</Directory>

<VirtualHost *:80>
   DocumentRoot "/var/www/html/nextcloud"
   ServerName example.duckdns.org
   ServerAlias example.duckdns.org
   ServerAdmin example@mymail.com
   ErrorLog "/var/log/httpd/error_log_example_duckdns_org"
   CustomLog "/var/log/httpd/access_log_example_duckdns_org" combined
</VirtualHost>

我得到:

$ apachectl configtest        
Syntax OK

我有什麼問題?

使用:Apache/2.4.43

當然,您/etc/httpd/conf/extra看起來是正確的,但是您的主要 Apache 配置文件(或其中包含的任何文件)是否在任何地方有類似的東西Include /etc/httpd/conf/extraIncludeOptional /etc/httpd/conf/*在其中?

引用自:https://unix.stackexchange.com/questions/599686