【发布时间】:2017-11-26 17:24:29
【问题描述】:
我正在尝试为 Ssl 连接配置 apache,但是当我尝试使用 https 访问网站时是不可能的。
这是我网站的虚拟主机:
<VirtualHost *:443>
DocumentRoot "C:\xampp\htdocs\www.example.com"
ServerName www.example.com
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "C:\xampp\htdocs\www.example.com"
ServerName example.com
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
</VirtualHost>
我在 c:\xampp\apache\conf\httpd.conf 的这一行之前省略了 #
LoadModule rewrite_module modules/mod_rewrite.so
我在 c:\xampp\apache\conf\extra\httpd-xampp.con 中添加了这些行
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect /xampp folder to https
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} xampp
RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
# Redirect /phpMyAdmin folder to https
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} phpmyadmin
RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
# Redirect /security folder to https
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} security
RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
# Redirect /webalizer folder to https
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} webalizer
RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
</IfModule>
我在以下文件的每个目录中添加了一个 SSLRequireSSL 指令:
Config File: c:\xampp\apache\conf\extra\httpd-xampp.conf
c:\xampp\phpmyadmin
c:\xampp\htdocs\xampp
c:\xampp\webalizer
c:\xampp\security\htdocs
Config File: c:\xampp\webdav
c:\xampp\webdav
重启apache时的错误日志:
[Fri Jun 23 10:00:24.739140 2017] [ssl:warn] [pid 5012:tid 268] AH01909: RSA certificate configured for localhost:443 does NOT include an ID which matches the server name
[Fri Jun 23 10:00:24.742070 2017] [ssl:warn] [pid 5012:tid 268] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Fri Jun 23 10:00:24.947148 2017] [ssl:warn] [pid 5012:tid 268] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Fri Jun 23 10:00:24.948125 2017] [ssl:warn] [pid 5012:tid 268] AH01909: RSA certificate configured for localhost:443 does NOT include an ID which matches the server name
[Fri Jun 23 10:00:24.949101 2017] [ssl:warn] [pid 5012:tid 268] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Fri Jun 23 10:00:25.077031 2017] [mpm_winnt:notice] [pid 5012:tid 268] AH00354: Child: Starting 150 worker threads.
谁能告诉我我做错了什么或错过了什么?
【问题讨论】:
标签: apache ssl mod-rewrite