我正在尝试在 Raspberry Pi 上设置 Apache 虚拟主机,以便我可以托管具有 2 个不同域的 2 个不同网站。我以前做过,没有任何问题,但现在我就没那么幸运了。
自从设置虚拟主机后,所有 SSL 连接现在都被拒绝 ( ERR_CONNECTION_REFUSED
),任何 HTTP 连接都会直接进入服务器根 ( var/www
)。
我的虚拟主机文件如下所示:
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName roboguy99.co.uk
</VirtualHost>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerAlias www.roboguy99.co.uk
ServerName roboguy99.co.uk
DocumentRoot /var/www/roboguy99.co.uk/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>
和
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName choughsttc.co.uk
</VirtualHost>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerAlias www.choughsttc.co.uk
ServerName choughsttc.co.uk
DocumentRoot /var/www/choughsttc.co.uk/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>
我的ports.conf
像这样:
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
NameVirtualHost *:443
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
NameVirtualHost *:443
Listen 443
</IfModule>
可能值得注意的是,我的服务器之前设置为使用 1 个域,该域自动将所有 HTTP 流量重定向到 SSL(并且工作正常)。
我确实用谷歌搜索了很多解决方案,但一无所获。如果灵魂是愚蠢的简单,我很抱歉。如果您需要查看更多文件,我会上传它们。所有帮助均适用。