TypechoJoeTheme

Dcr163的博客

统计

linux nginx虚拟机主机,禁止某个IP配置

2015-10-18
/
0 评论
/
777 阅读
/
正在检测是否收录...
10/18
把这段代码放到nginx安装目录配置文件nginx.conf,http{}中,不能放在默认server{}中,否则会报错,或服务失败,静止某个IP和某段IP也是放在自己的虚拟主机配置下

server {
listen       80;
server_name    www.php.com;                                   #这个www.php.com是自己的域名
index index.html index.htm index.php;
root  /home/free/nginx/www/www_php_com;        #这个是这个域名所对应的安装目录
 
        location ~ \.php$ {
        #    root           html;
             fastcgi_pass   127.0.0.1:9000;
             fastcgi_index  index.php;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
         }
error_page 404/404.html; 
 
#禁止某个IP网站访问
location / {
deny 192.168.1.90;       #静止某个IP
allow all;                          #允许所有
}
 
}
朗读
赞(0)
版权属于:

Dcr163的博客

本文链接:

https://dcr163.cn/66.html(转载时请注明本文出处及文章链接)

评论 (0)