我有以下配置:
<VirtualHost 123.0.1.2:80>
ServerName website.com
DocumentRoot "/var/www/website.com"
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
</VirtualHost>
<VirtualHost 123.0.1.2:443>
DocumentRoot "/var/www/website.com"
ServerName website.com
SSLEngine on
SSLCertificateFile /var/ssl/testing/server.crt
SSLCertificateKeyFile /var/ssl/testing/server.key
<Directory "/var/www/website.com">
allow from all
Options +Indexes
</Directory>
SSLVerifyClient none
</VirtualHost>
但是,这会出现 SSL 协议错误,如果我删除第一个 VirtualHost,就不会出现此错误。
干杯
答案1
您需要添加NameVirtualHost
。
尝试添加以下内容
NameVirtualHost 123.0.1.2:80
NameVirtualHost 123.0.1.2:443
更多信息: