nginx配置SSL证书https可以正常访问http访问400错误

2016-12-9 fredzeng WEB服务

  1. 给nginx配置SSL证书之后,https可以正常访问,http访问显示400错误,nginx的配置如下:

    server {

                listen 80 default backlog=2048;

                listen 443;

                server_name wosign.com;

                root /var/www/html;

                ssl on;

                ssl_certificate /usr/local/Tengine/sslcrt/ wosign.com.crt;

                ssl_certificate_key /usr/local/Tengine/sslcrt/ wosign.com .key;

            }

    http访问的时候,报错如下:

    400 Bad Request

    The 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的端口上去了,所以才会出现这样的问题。

  2. 2

    server {

                listen 80 default backlog=2048;

                listen 443 ssl;

                server_name wosign.com;

                root /var/www/html;

     

                ssl_certificate /usr/local/Tengine/sslcrt/ wosign.com.crt;

                ssl_certificate_key /usr/local/Tengine/sslcrt/ wosign.com .Key;

            }

    把ssl on;这行去掉,ssl写在443端口后面。这样http和https的链接都可以用,完美解决。

标签: nginx http ssl证书 https http400


版权所有:《DNS服务器IP地址,域名注册,CDN加速技术,linux,web服务器》 => 《nginx配置SSL证书https可以正常访问http访问400错误
本文地址:http://www.dnsdizhi.com/post-259.html
除非注明,文章均为 《DNS服务器IP地址,域名注册,CDN加速技术,linux,web服务器》 原创,欢迎转载!转载请注明本文地址,谢谢。

发表评论:

Powered by emlog sitemap