所以我有一个运行在ubuntu上的Apache2 Web服务器。 我已经成功地修改了正常的虚拟主机文件:80请求和所有的网站正常工作。 但是,一旦我尝试configuration虚拟主机的SSL,所有我的网站时提供了一个www重新路由到文件中的默认(第一个)网站。 例如,第一个https网站是www.thepeepinghole.tk。 如果我在https://www.geekychicgirls.tk中input,则会重新路由到www.thepeepinghole.tk。 有趣的是,如果我inputhttps://geekychicgirls.tk它去正确的网站。 如果任何人都可以帮助,我会非常感激,我一直坚持这个好几天。 非常感谢!
默认的SSL:
NameVirtualHost *:443 <IfModule mod_ssl.c> NameVirtualHost *:443 <VirtualHost *:443> ServerAdmin [email protected] DocumentRoot "/var/www/thepeepinghole" SSLEngine on SSLCertificateFile /ssl/14252798.crt SSLCertificateKeyFile /ssl/private.key SSLCertificateChainFile /ssl/New-PositiveSSL-bundle-12.ca-bundle ServerName thepeepinghole.tk:443 ServerAlias www.thepeepinghole.tk ErrorLog "/var/www/thepeepinghole/log/error.log" CustomLog "/var/www/thepeepinghole/log/access.log" common <Directory /var/www/thepeepinghole> DirectoryIndex index.html Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost> <VirtualHost *:443> ServerAdmin [email protected] DocumentRoot "/var/www/geekychicgirls" SSLEngine on SSLCertificateFile /ssl/14252798.crt SSLCertificateKeyFile /ssl/private.key SSLCertificateChainFile /ssl/New-PositiveSSL-bundle-12.ca-bundle ServerName geekychicgirls.tk:443 ServerAlias www.geekychicgirls.tk ErrorLog "/var/www/geekychicgirls/log/error.log" CustomLog "/var/www/geekychicgirls/log/access.log" common <Directory /var/www/geekychicgirls> DirectoryIndex index.html Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost>
apache2ctl -S的输出:
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName [Fri Mar 21 23:14:49 2014] [warn] NameVirtualHost *:443 has no VirtualHosts VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:443 is a NameVirtualHost default server thepeepinghole.tk (/etc/apache2/sites-enabled/000-default-ssl:5) port 443 namevhost thepeepinghole.tk (/etc/apache2/sites-enabled/000-default-ssl:5) port 443 namevhost geekychicgirls.tk (/etc/apache2/sites-enabled/000-default-ssl:24) *:80 is a NameVirtualHost default server www.bondsolutionsnj.com (/etc/apache2/sites-enabled/000-default:4) port 80 namevhost www.bondsolutionsnj.com (/etc/apache2/sites-enabled/000-default:4) port 80 namevhost www.accessorizewithstylenj.com (/etc/apache2/sites-enabled/000-default:22) port 80 namevhost www.futureretrogaming.com (/etc/apache2/sites-enabled/000-default:38) port 80 namevhost www.k9minecraft.tk (/etc/apache2/sites-enabled/000-default:56) port 80 namevhost www.k9proxy.tk (/etc/apache2/sites-enabled/000-default:72) port 80 namevhost www.thepeepinghole.tk (/etc/apache2/sites-enabled/000-default:89) port 80 namevhost www.geekychicgirls.tk (/etc/apache2/sites-enabled/000-default:105) Syntax OK
Apache2启动警告:
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName [Sat Mar 22 20:18:04 2014] [warn] NameVirtualHost *:443 has no VirtualHosts
好的,所以这个解决scheme对我来说很简单(只是花了很长时间才弄清楚):)
好的,所以我做了
NameVirtualHost *:443 <VirtualHost *:443> ServerName: www.mysitehere.com ServerAlias: mysitehere.com </VirtualHost>
我也摆脱了if语句。