包含标签 nginx 的文章

nginx浏览目录配置

在项目中有一个功能需要在浏览器页面中浏览服务器的目录。服务器使用Nginx,而Nginx提供了相应的ngx_http_autoindex_module 模块,该模块提供了我们想要的功能。 Nginx ngx_http_autoindex_module 模块 该模块有以下几个命令: 命令 默认值 值域 作用域 EG autoindex off on:开启目录浏览; off:关闭目录浏览……

阅读全文

nginx允许或拒绝get/post/put/delete请求

只允许get/post请求 1 2 3 4 5 6 7 8 9 if ($request_method !~* GET|POST) { return 403; } #或者 if ($request_method !~ ^(GET|POST)$) { return 403; } 拒绝PUT、DELETE、POST请求 1 2 3 4 5 6 7 8 9 if ($request_method = PUT){ return 403; } if ($request_method = DELETE){ return 403; } if ($request_method = POST){ return 403; } 注意:if和(之间要有一个空格,否则会报错。要放在server层里面。 1 2 3 server{ #放这里 }……

阅读全文