给nginx配置SSL证书之后,https可以正常访问,http访问显示400错误,nginx的配置:
server{
listen 80 default backlog=2048;
listen 443;
server_name wosign.com;
root /server/www/myweb;
ssl on;
ssl_certificate /server/ssl/test.com.crt;
ssl_certificate_key /server/ssl/test.com.key;
}
http访问的时候,报错如下:
400 Bad RequestThe plain HTTP requset was sent to HTTPS port.
Sorry for the inconvenience.
Please report this message and include the following information to us.
Thank you very much!
http的请求被发送到https的端口上去了,所以才会出现这样的问题。
server {
listen 80 default backlog=2048;
listen 443 ssl;
server_name wosign.com;
root /server/www/myweb;
ssl_certificate /server/ssl/test.com.crt;
ssl_certificate_key /server/ssl/test.com.key;
把ssl on;这行去掉,ssl写在443端口后面。这样http和https的链接都可以用。