我的目标是让我的服务器上运行SSL来运行HTTPS。我试图运行命令sudo certbot --apache为我的服务器生成一个证书,作为https://certbot.eff.org/lets-encrypt/ubuntutrusty-apache步骤的一部分。
我对此有问题,因为当我运行命令时,我得到了错误
Error while running apache2ctl graceful.
httpd not running, trying to start
Action 'graceful' failed.
Address already in use: AH00072: make_sock: could not bind to address [::]:80当我检查端口80上运行的是什么时,我看到了httpd.bin。
tcp6 0 0 :::80 :::* LISTEN 1372/httpd.bin但是,据说在上面的错误消息中没有运行httpd.bin。我试图杀死在端口80上运行的进程,但一直无法。我还试图定位Apache父进程(http://www.informit.com/articles/article.aspx?p=26130&seqNum=3)的PID,但是在usr/ /acpache目录中没有/acpache目录。
我应该如何处理这个过程?-我应该专注于扼杀这个过程,还是有其他方法来解决这个问题?
另一件令人困惑的事情是,当我运行sudo服务apache2状态时,结果是apache2没有运行,但是我也不能启动这个进程,因为端口80正在使用(不确定在我的场景中是否需要Apache2 )。
任何帮助都将不胜感激!
发布于 2018-05-10 06:46:35
目前,带有letsencrypt/certbot的--apache选项并不像预期的那样工作。有些更改应该应用于CertBot与Apache交互的机制,但它们尚未应用。当我发现这个问题的时候,我找不到我在2018年1月读过的那篇文章。
您可以在选项letsencrypt/certbot中使用certonly。使用此选项,该工具将启动自己的时态web服务器来生成证书文件。您的防火墙中应该打开端口80和443。你应该暂时阻止阿帕奇。不幸的是,当您renew证书时,您应该这样做。
sudo service apache2 stop # Ubuntu 14.04
sudo systemctl stop apache2.service # Ubuntu 16.04 and above
sudo letsencrypt certonly --rsa-key-size 4096 --email user@example.com -d example.com -d www.example.com -d another.example.com
# Select the option: Automatically use temporary web server (standalone)
sudo service apache2 start # Ubuntu 14.04
sudo systemctl start apache2.service # Ubuntu 16.04 and above然后,您需要手工编辑虚拟主机的配置文件。下面是一个将HTTP永久重定向到HTTPS (将example.com替换为FQDN)的示例:
ServerName example.com
# Redirect Requests to HTTPS
Redirect permanent / https://example.com/
ErrorLog ${APACHE_LOG_DIR}/example.com.error.log
CustomLog ${APACHE_LOG_DIR}/example.com.access.log combined
ServerName example.com
ServerAdmin admin@example.com
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
DocumentRoot /var/www/html
# Conf directives...
ErrorLog ${APACHE_LOG_DIR}/example.com.ssl.error.log
CustomLog ${APACHE_LOG_DIR}/example.com.ssl.access.log combined为Apache启用SSL模块,并再次重新启动它。
参考文献:
希望能帮上忙!
https://askubuntu.com/questions/1034295
复制相似问题