1. 程式人生 > >Nginx如何禁用非法請求http

Nginx如何禁用非法請求http

server {
        listen  80;
        server_name xxxxxxx;
           if ($request_method !~* GET|POST) {
            return 405;

        }

}

在nginx配置檔案中server中新增即可