nginx配置禁止ip访问80,443端口

1、禁止ip访问80端口

server {
        listen 80;
		server_name  _;
        return 403;
        }	

2、禁止ip访问80和443端口

server {
  listen 80 default;
  listen 443 default_server;
  server_name _;
  ssl_certificate /etc/nginx/cert/***.pem;
  ssl_certificate_key /etc/nginx/cert/***.key;
  ssl_session_timeout 5m;
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;
  location / {
    default_type text/html;
    return 404;
  }
}

 

posted on 2021-11-22 15:23  !!雪莲花!!  阅读(2189)  评论(0)    收藏  举报