nginx出现400 Bad Request The plain HTTP request was sent to HTTPS port的解决方式
75 人阅读 | 时间:2023年07月17日 20:42
aapanel (国外那个宝塔) 控制面板里 Nginx我设置了
server{
listen 10001 ssl;
server_name mydomain.com;
以非标准端口HTTPS访问,能正常访问网页。
但非标准端口HTTP访问,以及ip:10001访问,会显示↓
400 Bad Request
The plain HTTP request was sent to HTTPS port
nginx
感觉有点安全隐患,我期望 nginx完全都不显示,一直转圈圈就好了。
=================
解决方式:
nginx conf增加
if ($server_port !~ 10001){
rewrite ^(/.*)$ https://$host$1 permanent;
}
评论专区