Nginx 禁止其他ip访问某目录只允许某ip访问
· 技术积累 · Nginx

在你需要的配置文件中加上此段:

location ^~ /admin/ {           #你禁止其他人访问的目录
allow 192.168.1.1;   #允许的ip,也可以是网段使用掩码方式
deny all;                   #拒绝所有

#转发php
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;

}

针对多个目录文件列表控制显示的类型时间大小

location ~* /list/(001|002|003|004|005) {
    autoindex on;
    autoindex_localtime on;
    autoindex_exact_size off;
}

本文最后更新时间 2023-12-12
文章链接地址:
https://me.jinchuang.org/archives/30.html
本站文章除注明[转载|引用|原文]出处外,均为本站原生内容,转载前请注明出处


留言