我有一台服务器,其中有许多虚拟主机,它们位于许多不同的文件和位置。一种,只有一种在给问题。数以百计的人(几乎相同)做的很好。
www.customer.be网站可以正常加载,包括正确的证书。非www版本将加载dashboard.example.com的证书(第一个由apache2加载的虚拟主机文件)。
更奇怪的是,非www版本唯一要做的就是重定向到www版本。如果您在浏览器中“仍然继续”,则重定向会正确进行。
这是文件(实际域名已更改),请记住,其中有数百个,除了域之外,其他都相同:
<VirtualHost *:80>
ServerName customer.1.example.net
Redirect / https://www.customer.be/
</VirtualHost>
<VirtualHost *:80>
ServerName www.customer.be
Redirect / https://www.customer.be/
</VirtualHost>
<VirtualHost *:80>
ServerName customer.be
Redirect / https://www.customer.be/
</VirtualHost>
<VirtualHost *:443>
ServerName customer.be
SSLEngine on
SSLCertificateFile "/var/www/1.example.net/letsencrypt/certs/www.customer.be/fullchain.pem"
SSLCertificateKeyFile "/var/www/1.example.net/letsencrypt/certs/www.customer.be/privkey.pem"
Redirect / https://www.customer.be/
</VirtualHost>
<VirtualHost *:443>
ServerName www.customer.be
DocumentRoot /var/www/1.example.net/platform/
<Directory /var/www/1.example.net/platform/>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile "/var/www/1.example.net/letsencrypt/certs/www.customer.be/fullchain.pem"
SSLCertificateKeyFile "/var/www/1.example.net/letsencrypt/certs/www.customer.be/privkey.pem"
</VirtualHost>
这是从中加载证书的证书(这是apache2加载的第一个证书):
<VirtualHost *:80>
ServerName dashboard.example.com
Redirect / https://dashboard.example.com/
</VirtualHost>
<VirtualHost *:80>
ServerName dashboard.example.be
Redirect / https://dashboard.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName dashboard.example.com
DocumentRoot /var/www/dashboard/
<Directory /var/www/dashboard/>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile "/etc/dehydrated/certs/dashboard.example.com/fullchain.pem"
SSLCertificateKeyFile "/etc/dehydrated/certs/dashboard.example.com/privkey.pem"
</VirtualHost>
下一个