1 个 IP 上的多个 SSL 通配符
Multiple SSL wildcards on 1 IP
目前我的服务器在 https/ssl 上有 1 个网站 运行。问题是当我启用第二个虚拟主机时,也使用 https/ssl,我拥有的第一个网站 运行 现在正在使用新网站的 ssl 证书。
我试过将这两个网站放在一个虚拟主机文件中,但没有用,所以我制作了 2 个单独的文件。
这是我的虚拟主机配置文件:
(根据字母顺序将它们命名为 websiteZ 和 website Y)
vhost当前运行网站.conf
<VirtualHost *:80>
ServerAlias *.websiteZ.nl
Redirect 301 / https://websiteZ.nl
</VirtualHost>
NameVirtualHost *:443
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.websiteZ.nl
DocumentRoot "/var/www/html/websites/websiteZ.nl/public"
<Directory "/var/www/html/websites/websiteZ.nl/public">
Require all granted
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/websiteZ.nl/certificate.crt
SSLCertificateKeyFile /etc/apache2/ssl/websiteZ.nl/certificate.key
SSLCertificateChainFile /etc/apache2/ssl/websiteZ.nl/cabundle.crt
</VirtualHost>
</IfModule>
带有 ssl .conf 的新网站
<VirtualHost *:80>
ServerName websiteY.nl
ServerAlias www.websiteY.nl
RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule ^(.*)$ https://%{HTTP_HOST} [R=301,L]
RewriteRule ^(/(.*))?$ https://%{HTTP_HOST}/ [R=301,L]
DocumentRoot "/var/www/html/websites/websiteY.nl/public/"
<Directory "/var/www/html/websites/websiteY.nl/public/">
Require all granted
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.websiteY.nl
DocumentRoot "/var/www/html/websites/websiteY.nl/public"
<Directory "/var/www/html/websites/websiteY.nl/public">
Require all granted
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
SSLStrictSNIVHostCheck on
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/websiteY.nl/certificate.crt
SSLCertificateKeyFile /etc/apache2/ssl/websiteY.nl/certificate.key
SSLCertificateChainFile /etc/apache2/ssl/websiteY.nl/cabundle.crt
</VirtualHost>
</IfModule>
ports.conf
NameVirtualHost *:80
NameVirtualHost *:443
Listen 80
<IfModule mod_ssl.c>
Listen 443
</IfModule>
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
我查了 SNI 的东西,但我想我遗漏了什么。我的理解是我必须使用 NameVirtualHost 才能使其工作。
服务器 运行 在 AWS ece2 上 Ubuntu 16.04.2
当我在终端输入时出现问题:
a2ensite websiteY.conf
当我这样做时,websiteZ 将失去它的 https 证书,并会显示一个大红叉,上面写着:不安全!当您点击继续时,它会链接到网站 Y
我有点无能为力,有人可以帮我吗?谢谢!
当输入www.websiteZ.nl
而不输入https
时,请求会先被
捕获
<VirtualHost *:80>
ServerAlias *.websiteZ.nl
Redirect 301 / https://websiteZ.nl
</VirtualHost>
因此重定向到 https://websiteZ.nl
由于您的 :443
虚拟主机的 none 没有 ServerName
或 ServerAlias
配置 websiteZ.nl
,那么按字母顺序第一个 .conf 文件中的那个将被使用,在本例中是带有 websiteY 证书的那个。
目前我的服务器在 https/ssl 上有 1 个网站 运行。问题是当我启用第二个虚拟主机时,也使用 https/ssl,我拥有的第一个网站 运行 现在正在使用新网站的 ssl 证书。
我试过将这两个网站放在一个虚拟主机文件中,但没有用,所以我制作了 2 个单独的文件。
这是我的虚拟主机配置文件:
(根据字母顺序将它们命名为 websiteZ 和 website Y)
vhost当前运行网站.conf
<VirtualHost *:80>
ServerAlias *.websiteZ.nl
Redirect 301 / https://websiteZ.nl
</VirtualHost>
NameVirtualHost *:443
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.websiteZ.nl
DocumentRoot "/var/www/html/websites/websiteZ.nl/public"
<Directory "/var/www/html/websites/websiteZ.nl/public">
Require all granted
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/websiteZ.nl/certificate.crt
SSLCertificateKeyFile /etc/apache2/ssl/websiteZ.nl/certificate.key
SSLCertificateChainFile /etc/apache2/ssl/websiteZ.nl/cabundle.crt
</VirtualHost>
</IfModule>
带有 ssl .conf 的新网站
<VirtualHost *:80>
ServerName websiteY.nl
ServerAlias www.websiteY.nl
RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule ^(.*)$ https://%{HTTP_HOST} [R=301,L]
RewriteRule ^(/(.*))?$ https://%{HTTP_HOST}/ [R=301,L]
DocumentRoot "/var/www/html/websites/websiteY.nl/public/"
<Directory "/var/www/html/websites/websiteY.nl/public/">
Require all granted
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.websiteY.nl
DocumentRoot "/var/www/html/websites/websiteY.nl/public"
<Directory "/var/www/html/websites/websiteY.nl/public">
Require all granted
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
SSLStrictSNIVHostCheck on
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/websiteY.nl/certificate.crt
SSLCertificateKeyFile /etc/apache2/ssl/websiteY.nl/certificate.key
SSLCertificateChainFile /etc/apache2/ssl/websiteY.nl/cabundle.crt
</VirtualHost>
</IfModule>
ports.conf
NameVirtualHost *:80
NameVirtualHost *:443
Listen 80
<IfModule mod_ssl.c>
Listen 443
</IfModule>
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
我查了 SNI 的东西,但我想我遗漏了什么。我的理解是我必须使用 NameVirtualHost 才能使其工作。
服务器 运行 在 AWS ece2 上 Ubuntu 16.04.2
当我在终端输入时出现问题:
a2ensite websiteY.conf
当我这样做时,websiteZ 将失去它的 https 证书,并会显示一个大红叉,上面写着:不安全!当您点击继续时,它会链接到网站 Y
我有点无能为力,有人可以帮我吗?谢谢!
当输入www.websiteZ.nl
而不输入https
时,请求会先被
<VirtualHost *:80>
ServerAlias *.websiteZ.nl
Redirect 301 / https://websiteZ.nl
</VirtualHost>
因此重定向到 https://websiteZ.nl
由于您的 :443
虚拟主机的 none 没有 ServerName
或 ServerAlias
配置 websiteZ.nl
,那么按字母顺序第一个 .conf 文件中的那个将被使用,在本例中是带有 websiteY 证书的那个。