1、隐藏nginx版本号
http{
...
server_tokens off;
...
}
2、禁止访问指定目录下的程序和文件
location ~ ^/images/.*\.(php|php5|.sh|.pl|.py)$ { deny all; }
location ~ ^/(static|js) { deny all; }
location /admin/ { return 404; }
http{
...
server_tokens off;
...
}
location ~ ^/images/.*\.(php|php5|.sh|.pl|.py)$ { deny all; }
location ~ ^/(static|js) { deny all; }
location /admin/ { return 404; }