server {
listen 80;
server_name 192.168.1.1;
index index.html index.htm index.php;
root /data/www/app/webroot;
charset utf-8;
allow 192.168.1.2;
allow 192.168.1.3;
deny all;
location ~ .*\.php$ {
include fcgi.conf;
fastcgi_pass 127.0.0.1:10080;
fastcgi_index index.php;
expires off;
access_log on;
access_log /data/logs/dpcq_php.log
access buffer=32k;
}
}
注:allow XXX 允许访问的ip;deny XXX 拒绝访问的ip。

本文深入解析了一段基于IP访问控制的服务器配置代码,重点介绍了如何通过配置文件实现对特定IP地址的允许访问与拒绝访问策略,确保服务器资源的安全性与高效利用。详细阐述了`server`部分的各参数作用及实际应用场景。

1241

被折叠的 条评论
为什么被折叠?



