nginx访问控制

 

白名单:

allow 127.0.0.1;
allow 192.168.145.6;
deny all;

 


 白名单:

限制只让某个ip访问
    allow          127.0.0.1;
    deny           all;

 


 黑名单(可只写deny):

限制ip段访问

deny 10.0.1.0/24;


 

 

  vim /usr/local/nginx/conf/vhosts/test.conf

 

location ~ .*admin\.php$
    {
        allow          127.0.0.1;
        deny           all;
        include fastcgi_params;
        fastcgi_pass unix:/tmp/php-fcgi.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME  /data/www$fastcgi_script_name;

     }

 

 

 

 

posted @ 2015-11-27 11:12  沐风先生  阅读(125)  评论(0编辑  收藏  举报