Nginx 禁止通过IP 访问http服务

新增a.conf

server {
listen 80 default;
return 500;
}

Nginx 禁止通过IP 访问https服务

编辑a.conf

server {
listen 443;
ssl on;
ssl_certificate   cert/xxx/xxx.pem;
ssl_certificate_key  cert/xxx/xxx.key;
return 500;
}

证书换成你自己的,切记一定要加上证书,否则禁止了所有443端口的访问问`