Apache忽略具有多个SSL域的documentroot

时间:2015-01-20 16:05:00

标签: apache ssl httpd.conf sni

我把头发拉出来。

我让Apache运行两个使用SNI运行SSL的不同域。

配置如下。 如果我连接到console.somedomain.com,它会将用户放在/ var / www / html /而不是/ var / www / html / somedomain / Admin / adminv4 /

但是,如果我连接到support1.somedomain.com,它可以正常工作并且位于正确的目录中。

这里有什么地球错了?该目录有效。

<VirtualHost *:443>
DocumentRoot "/var/www/html/somedomain/Admin/adminv4/"
ServerName console.somedomain.com
SSLEngine On
SSLProtocol all -SSLv2
SSLCertificateFile /etc/httpd/ssl/console.somedomain.com/console.somedomain.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/console.somedomain.com/console.somedomain.com.key
<Directory "/var/www/html/somedomain/Admin/adminv4/">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
#
#
#NameVirtualHost support1.somedomain.com:443
<VirtualHost *:443>
DocumentRoot "/var/www/html/somedomain/"
ServerName support1.somedomain.com
SSLEngine on
SSLProtocol all -SSLv2
SSLCertificateFile /etc/httpd/ssl/support1_somedomain_com/support1.somedomain.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/support1_somedomain_com/support1.somedomain.com.key
SSLCertificateChainFile /etc/httpd/ssl/support1_somedomain_com/latest.ca-bundle
<Directory "/var/www/html/somedomain/">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

1 个答案:

答案 0 :(得分:3)

修正了它。

在此命令后结束:

apachectl -t -D DUMP_VHOSTS

*:443是NameVirtualHost          默认服务器console.somedomain.com(/etc/httpd/conf.d/ssl.conf:56)          端口443 namevhost console.somedomain.com(/etc/httpd/conf.d/ssl.conf:56)          端口443 namevhost console.somedomain.com(/etc/httpd/conf.d/ssl.conf:56)          端口443 namevhost console.somedomain.com(/etc/httpd/conf/httpd.conf:441)          端口443 namevhost console.somedomain.com(/etc/httpd/conf/httpd.conf:441)          端口443 namevhost support1.somedomain.com(/etc/httpd/conf/httpd.conf:455)          端口443 namevhost support1.somedomain.com(/etc/httpd/conf/httpd.conf:455)

在ssl.conf中显示控制台已被引用。

看完之后,SSL.conf只有默认的ssl。

然后我记得我的实际系统主机名是console.somedomain.com

所以, 我删除了默认设置(我还不想在SSL上使用其他任何东西。只是我定义的vhosts。)

重新启动的apache现在可以正常工作: apachectl -t -D DUMP_VHOSTS *:443是NameVirtualHost          默认服务器support1.somedomain.com(/etc/httpd/conf/httpd.conf:444)          端口443 namevhost support1.somedomain.com(/etc/httpd/conf/httpd.conf:444)          端口443 namevhost support1.somedomain.com(/etc/httpd/conf/httpd.conf:444)          端口443 namevhost console.somedomain.com(/etc/httpd/conf/httpd.conf:458)          端口443 namevhost console.somedomain.com(/etc/httpd/conf/httpd.conf:458)