Nginx服务权限控制与随机首页

Nginx服务权限控制

nginx默认允许所有人访问

allow 允许访问设置

allow 192.168.2.3;
allow all;

deny 拒绝访问设置

deny 192.168.2.3;
deny all;

实例:nginx允许所有人访问,拒绝 10.98.226.96该ip访问

location / {
            root   html;
            index index.php index.html index.htm;
                
            deny 10.98.226.96;
            allow all;
        }

Nginx Random_index随机首页

开启Random_index模块:

有–with-http_random_index_module就说明已经支持Random_index模块

/usr/local/nginx/sbin/nginx -V 

random_index使用:

random_index on;

使用:

location / {
            root   html;
           random_index on;
           # index index.php index.html index.htm;
            
        }

#客户端测试
http://106.52.36.65

猜你喜欢

转载自blog.csdn.net/weixin_39218464/article/details/112710816