我已经做了几个脚本,以便在我的数字海洋Debian机器上build立一个站点。 保护站点的脚本基本上只是创buildsites-availble可用文件,运行certbot命令,然后提示您重新启动Apache。 它的工作完美无瑕。
导致问题的脚本中的命令:
sudo cerbot -d mywebsite.com
用--apache标志会引发同样的错误。
我得到的错误
Error while running apache2ctl configtest. Action 'configtest' failed. The Apache error log may have more information. AH00526: Syntax error on line 19 of /etc/apache2/sites-enabled/mywebsite.ca.conf: SSLCertificateFile: file '/etc/letsencrypt/live/www.mywebsite.ca/fullchain.pem' does not exist or is empty
参考文件
<IfModule mod_ssl.c> <VirtualHost *:80> ServerName mywebsite.ca DocumentRoot /var/www/html/mywebsite.ca Redirect permanent / https://mywebsite.ca </VirtualHost> <VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/mywebsite.ca ServerName mywebsite.ca ServerAlias www.mywebsite.ca ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on SSLCertificateFile /etc/letsencrypt/live/www.mywebsite.ca/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/www.mywebsite.ca/privkey.pem #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> # "force-response-1.0" for this. BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown </VirtualHost>
第19行是SSLCertificateFile /etc/letsencrypt/live/www.mywebsite.ca/fullchain.pem
从我的apache2错误日志中的一些事情
AH00112: Warning: DocumentRoot [/var/lib/letsencrypt/tls_sni_01_page/] does not exist
[Thu Aug 03 12:13:00.265826 2017] [ssl:warn] [pid 12795] AH01906: 9113409597ce29a2adba7e6df41d732f.81d7a00618deb2e454817e363526c145.acme.invalid:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
有一个相同的(除了域名)网站启用文件的另一个域可以正常工作。
我已经尝试了几次运行certbot命令的变体,我很紧张地尝试了太多东西,因为这台服务器上还有其他的活动站点。
什么导致这个错误和任何提示在哪里可以修复它?