1. 不显示svn的版本号
- vi /usr/local/nginx/conf/nginx.conf
- server_tokens off;
2. 过滤.svn中的所有文件
- location ~ ^(.*)\/\.svn\/
- {
- deny all;
- }
从svn中直接签出的代码中含有.svn和其中的一些文件。
2. 过滤phpinfo.php文件
- location ~ ^(.*)\/phpinfo.php
- {
- deny all;
- }
3. nginx_status限制IP访问
- location /nginx_status {
- stub_status on;
- access_log off;
- allow x.x.x.x;
- deny all;
- }
5. 限制对工具目录的访问
- location ~ ^(.*)\/tools\/
- {
- allow x.x.x.x;
- deny all;
- fastcgi_pass 192.168.2.11:9000;
- fastcgi_index index.php;
- include fcgi.conf;
- }
如果该工具目录中有phpmyadmin等,一定需要进行设置。这些段落都需要放在php解析的段落之前。
















