nginx怎么配置ssl可以即允许http访问也允许https访问
3个回答
展开全部
方法/步骤
给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
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配置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
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的链接都可以用,完美解决。
2017-09-29 · 百度认证:Gworg官方账号,科技领域创作者
Gworg
Gworg提供全球可信的SSL数字证书、服务器证书以及中文数字证书、PDF签名证书等服务,ssl证书申请、审核、颁发、安装。数字证书被广泛运用于各大网站加密、可严格防范钓鱼网站、黑客窃听。
向TA提问
关注
展开全部
安装证书后,不配置301或者302跳转就可以了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
nginx配置ssl即允许http访问允许https访问
-
-
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询