尝试设置 SSL 证书,但 a2ensite 之后 Apache 拒绝启动

尝试设置 SSL 证书,但 a2ensite 之后 Apache 拒绝启动

正如标题所述,我使用的是全新安装的 ubuntu 16.04 系统,

我运行 sudo service apache2 status,它显示:

Active: inactive (dead) since Thu 2017-10-26 15:11:36 PDT; 3s ago
Docs: man:systemd-sysv-generator(8)
Process: 3891 ExecStop=/etc/init.d/apache2 stop (code=exited, 
status=0/SUCCESS)
Process: 3873 ExecReload=/etc/init.d/apache2 reload (code=exited, 
status=0/SUCCESS)
Process: 3821 ExecStart=/etc/init.d/apache2 start (code=exited, 
status=0/SUCCESS)

Oct 26 15:10:50 12345server3 apache2[3821]:  * Starting Apache 
httpd web server apache2
Oct 26 15:10:50 12345server3 apache2[3821]: AH00558: apache2: 
Could not reliably determine the server's fully qualified domain name, 
using 127.0.1.1. Set 
Oct 26 15:10:51 12345server3 apache2[3821]:  *
Oct 26 15:10:51 12345server3 systemd[1]: Started LSB: Apache2 web 
server.
Oct 26 15:11:36 12345server3 systemd[1]: Reloading LSB: Apache2 
web server.
Oct 26 15:11:36 12345server3 apache2[3873]:  * Reloading Apache 
httpd web server apache2
Oct 26 15:11:36 12345server3 apache2[3873]:  *
Oct 26 15:11:36 12345server3 systemd[1]: Reloaded LSB: Apache2 web 
server.
Oct 26 15:11:36 12345server3 apache2[3891]:  * Stopping Apache 
httpd web server apache2
Oct 26 15:11:36 12345server3 apache2[3891]:  *

我的 vhost 配置如下:

<Directory /var/www/html/fdsfdsdsa.com>
    Require all granted
</Directory>
<VirtualHost *:80>

ServerName fdsfdsdsa.com
    ServerAlias www.fdsfdsdsa.com
ServerAdmin [email protected]
DocumentRoot /var/www/html/fdsfdsdsa.com



ErrorLog /var/www/html/fdsfdsdsa.com/logs/error.log
CustomLog /var/www/html/fdsfdsdsa.com/logs/access.log combined



    <Directory /var/www/html/fdsfdsdsa.com>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    </Directory>
</VirtualHost>

<Directory /var/www/html/fdsfdsdsa.com>
    Require all granted
</Directory>

<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/ssl/certs/fdsfdsdsa.com.crt
SSLCertificateKeyFile /etc/ssl/private/fdsfdsdsa.com.key
SSLCertificateChainFile /etc/ssl/certs/2.crt

ServerAdmin [email protected]
ServerName fdsfdsdsa.com
ServerAlias fdsfdsdsa.com #If using alternate names for a host
DocumentRoot /var/www/html/fdsfdsdsa.com
ErrorLog /var/www/html/fdsfdsdsa.com/logs/errorssl.log
CustomLog /var/www/html/fdsfdsdsa.com/logs/accessssl.log combined
<Directory /var/www/html/fdsfdsdsa.com>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    </Directory>

</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

我不知道问题出在哪里,我刚刚制作了证书并将它们放在正确的文件夹中,只要我访问这个 SSL 站点,apache2 就会立即关闭

错误日志仅显示:“AH00016:配置失败”

如果我禁用 SSL 站点,其他站点仍可正常运行

任何能提供帮助或提出想法的人都将受到赞赏。

答案1

这很可能是您的 SSL 证书文件的问题。您可以使用以下命令验证它们:http://httpd.apache.org/docs/2.4/en/ssl/ssl_faq.html#verify

相关内容