arc*_*rty 7 sni namevirtualhost apache-2.2
Apache 似乎将所有 https 请求路由到第一个,<VirtualHost *:443>而不管 ServerName/ServerAlias 字段上的 SNI 匹配如何。
Apache 使用 SNI
服务器版本构建:Apache/2.2.22 (Ubuntu)
服务器构建:2013 年 3 月 8 日 15:53:13
OpenSSL 1.0.1 2012 年 3 月 14 日
error.log 报告:
Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
Run Code Online (Sandbox Code Playgroud)
这表明 SNI 正在按照http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI工作(您如何判断您的 Apache 构建是否支持 SNI?)
SSL_TLS_SNI使用 HTTPS 请求时似乎已正确设置(使用 验证phpinfo())
配置:
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
NameVirtualHost *:443
Listen 443
</IfModule>
#<VirtualHost *:443>
# <Location />
# Order allow,deny
# Deny from all
# </Location>
#</VirtualHost>
<VirtualHost *:443>
SSLEngine on
ServerAdmin webmaster@localhost
ServerName server.com
ServerAlias server.com
DocumentRoot /web/default
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /path/server.com.crt
SSLCertificateKeyFile /path/server.com.key
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
ServerAdmin webmaster@localhost
ServerName alias.com
ServerAlias alias.com
DocumentRoot /web/default
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /path/alias.com.crt
SSLCertificateKeyFile /path/alias.com.key
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
无论https://server.com和https://alias.com尝试服务证书(和内容,如果你忽略证书警告)从server.com
使用 HTTP:80 类似的配置工作正常(唯一的变化是 SSLEngine 和证书/密钥路径)
如果我取消注释第一个虚拟主机(限制对已定义站点的 HTTPS 访问),那么我总是会收到 SSL 错误(即使它是已定义站点)
谢谢
编辑:
附加标志
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM
SSLStrictSNIVHostCheck on
SSLVerifyClient none
SSLProxyEngine off
Run Code Online (Sandbox Code Playgroud)
SSLStrictSNIVHostCheck on 所以它应该只支持启用 SNI 的浏览器
apache2ctl -S 输出:
*:443 is a NameVirtualHost
default server server.com (/etc/apache2/sites-enabled/000-default:22)
port 443 namevhost server.com (/etc/apache2/sites-enabled/000-default:22)
port 443 namevhost alias.com (/etc/apache2/sites-enabled/000-default:39)
port 443 namevhost other.com (/etc/apache2/sites-enabled/other:22)
Run Code Online (Sandbox Code Playgroud)
更新
因此,出于某种奇怪的原因,问题似乎已经自行解决了。
也许这是某种奇怪的缓存问题或其他问题(尽管我已经apache2ctl stop/start/restart编辑sudo service apache2 stop/start/restart/reload了很多次,并在服务器本地以及使用几台不同的机器上进行了测试)。
如果这个问题可以作为任何参考,请随意删除或保留它。
感谢大家的帮助!
| 归档时间: |
|
| 查看次数: |
20249 次 |
| 最近记录: |