我按照本教程安装 SSL http://guides.jlbn.net/setssl/setssl1.html
我设置为localhost
配置完成后,我可以访问 HTTPS(https:// localhost/
),但是,当我想访问 HTTP 时(http:// localhost/
)
它显示
错误的请求
您的浏览器发送了一个此服务器无法理解的请求。原因:您正在向启用 SSL 的服务器端口发送纯 HTTP 请求。请使用 HTTPS 方案访问此 URL。提示:https:// localhost/
如何使 HTTP 和 HTTPS 同时运行?
我读SSL - 如何使 http 和 https 正常工作 我还将 80 和 443 的 VirtualHost 添加到 httpd.conf。但是没有成功。
请帮忙。谢谢
-httpd.conf (相关)-
LoadModule ssl_module modules/mod_ssl.so
ServerName localhost:80
DocumentRoot "c:/wamp/www/"
<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
NameVirtualHost *
<VirtualHost *:80>
ServerName localhost
DocumentRoot "c:/wamp/www"
</VirtualHost>
-httpd-ssl.conf (相关)-
Listen 443
<VirtualHost _default_:443>
DocumentRoot "C:/wamp/www/ssl"
ServerName localhost
ServerAdmin admin@localhost
ErrorLog "C:/wamp/bin/Apache/apache2.2.21/conf/ssl/logs/ssl_error.log"
TransferLog "C:/wamp/bin/Apache/apache2.2.21/conf/ssl/logs/ssl_access.log"
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile "C:/wamp/bin/Apache/apache2.2.21/conf/ssl/localhost.crt"
SSLCertificateKeyFile "C:/wamp/bin/Apache/apache2.2.21/conf/ssl/localhost.key"
#SSLCertificateChainFile "c:/Apache2/conf/server-ca.crt"
#SSLCACertificatePath "c:/Apache2/conf/ssl.crt"
#SSLCACertificateFile "c:/Apache2/conf/ssl.crt/ca-bundle.crt"
#SSLCARevocationPath "c:/Apache2/conf/ssl.crl"
#SSLCARevocationFile "c:/Apache2/conf/ssl.crl/ca-bundle.crl"
#SSLVerifyClient require
#SSLVerifyDepth 10
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "C:/wamp/www/ssl">
SSLOptions +StdEnvVars
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
BrowserMatch ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog "C:/wamp/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
答案1
天啊...我已经发现问题了。
它发生在httpd.conf
以前我只是用端口 80 (HTTP) 运行我httpd.conf
刚刚输入
NameVirtualHost *
必须像这样输入
NameVirtualHost *:80
端口需要具体。
之后我的 WAMP 服务器运行顺利!