我的 Apache 配置出了点问题。当我阅读错误日志时,我可以看到以下内容:
[client xxx.xxx.xx.xx] AH01964: Connection to child 1 established (server www.mywebsite.com:443)
[client xxx.xxx.xx.xx] AH01964: Connection to child 6 established (server www.mywebsite.com:443)
[client xxx.xxx.xx.xx] AH01964: Connection to child 10 established (server www.mywebsite.com:443)
[client xxx.xxx.xx.xx] AH01964: Connection to child 15 established (server www.mywebsite.com:443)
[client xxx.xxx.xx.xx] AH01964: Connection to child 18 established (server www.mywebsite.com:443)
(70014)End of file found: [client xxx.xxx.xx.xx] AH01991: SSL input filter read failed.
(70014)End of file found: [client xxx.xxx.xx.xx] AH01991: SSL input filter read failed.
(70014)End of file found: [client xxx.xxx.xx.xx] AH01991: SSL input filter read failed.
(70014)End of file found: [client xxx.xxx.xx.xx] AH01991: SSL input filter read failed.
(70014)End of file found: [client xxx.xxx.xx.xx] AH01991: SSL input filter read failed.
有时,还有这样一种情况:
(70007)The timeout specified has expired: [client xxx.xxx.xx.xx] AH01991: SSL input filter read failed.
我其实不知道……所以我的网站是完全 HTTP 的,除了两个页面是 HTTPS 的。这是我的虚拟主机:
<VirtualHost *:80>
ServerName mywebsite.com
Redirect permanent / http://www.mywebsite.com/
</VirtualHost>
<VirtualHost *:80>
ServerName www.mywebsite.com
ServerAlias img.mywebsite.com
ServerAdmin xxx
DocumentRoot /home/mywebsite/www/public
<Directory /home/mywebsite/www/>
Options Indexes Multiviews FollowSymlinks
AllowOverride All
Require all granted
ErrorDocument 403 http://www.google.com/
</Directory>
<Directory /home/mywebsite/www/public/resource/private/>
Require all denied
ErrorDocument 403 http://www.mywebsite.com/
</Directory>
<Location "/robots.txt">
Require all granted
</Location>
LogLevel info
ErrorLog ${APACHE_LOG_DIR}/mywebsite_error.log
CustomLog ${APACHE_LOG_DIR}/mywebsite_access.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.mywebsite.com
DocumentRoot /home/mywebsite/www/public
<Directory /home/mywebsite/www/>
Options Indexes FollowSymlinks Multiviews
AllowOverride all
Require all granted
</Directory>
LogLevel info
ErrorLog ${APACHE_LOG_DIR}/mywebsite_error.log
CustomLog ${APACHE_LOG_DIR}/mywebsite_access.log combined
SSLEngine on
SSLCertificateFile ./mywebsite.crt
SSLCertificateKeyFile ./mywebsite.key
SSLCertificateChainFile ./intermediate.crt
</VirtualHost>
</IfModule>
那么,我哪里犯了错误?我找不到它...你能帮助我吗?
感谢 :)
答案1
我读到 Apache 不支持基于名称的虚拟主机上的 SSL,仅支持基于 IP 的虚拟主机上的 SSL。所以我更改了它:
<VirtualHost *:443>
经过:
<VirtualHost 192.168.1.1:443>
现在,它似乎有效,我不知道这是否是一个好的解决方案,但我没有任何错误......
答案2
答案3
对于我来说,这个错误的解决方案非常简单,如下所示(以 root 身份添加文件/文件夹后出现此错误):
chown www-data: /var/www -R
chmod 755 /var/www -R
答案4
我遇到了同样的错误,对我来说,原因是 <VirtualHost *:443> 在 Apache 中的 2 个不同配置文件中被定义。一次是在 SSL.conf 中,第二次是在我添加的 .conf 文件中。一旦我从第二个文件中删除对 <VirtualHost *:443> 的引用(及其结束参数),一切就都正常了。