【发布时间】:2016-09-23 15:17:43
【问题描述】:
我的 vps 上安装了 xampp。我的网站现在完美运行。但我需要使用 ssl 来运行我的网站。
我已经阅读了很多关于它的教程,其中大部分都是相同的。不管怎样,我照他们说的做了。什么都对我不起作用。
我使用 ssh 而非 CA 机构创建了证书。只是为了测试。
我已编辑 php.ini 文件以启用 ssl 扩展。
我已经编辑了 httpd-ssl.conf 和 httpd-vhosts.conf 文件。
这是我的 httpd-vhosts.conf 文件:
NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
ServerAdmin info@example.com
DocumentRoot "C:/xampp/htdocs/"
ServerName example.com
ServerAlias www.example.com:8080
ErrorLog "logs/example.com-error.log"
CustomLog "logs/example.com-access.log" common
</VirtualHost>
<VirtualHost *:443>
DocumentRoot C:\xampp\htdocs\
ServerName example.com
<Directory C:\xampp\htdocs\n>
AllowOverride All
Allow from All
</Directory>
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
<FilesMatch "\.(cgi|shtml|pl|asp|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "C:/xampp/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
</VirtualHost>
当我输入 https://example.com 或 example.com:443 时,网站无法打开。
有什么办法吗?
更新:
这是 apache 错误日志文件中的日志:
[2016 年 9 月 23 日星期五 19:09:11.355966] [ssl:warn] [pid 2616:tid 284] AH01909:example.com:443:0 服务器证书不包含 ID 与服务器名称匹配
【问题讨论】:
-
" 对我不起作用。"是关于任何人都可以说描述错误的最无用的事情。你能澄清“不起作用”吗?怎么了?你期望它发生什么?同样关于警告,它只是一个不会阻止 httpd 运行的警告。您必须尝试的事情:1º 在本地访问并使用 ip 丢弃 dns 问题,2º 制作与“ServerName”指令中的名称匹配的 CN 证书以消除该警告。
-
我已经在问题的最后告诉了我什么不起作用。我说了我想要的。证书和配置文件中的服务器名称相同。我不知道这个错误是为了什么。
-
如果 HTTPD 抱怨它,显然证书中的 CN 与您定义的 ServerName 不匹配。无论如何,很高兴你自己解决了。