VPS侦探论坛
标题:
apache和nginx下禁止访问txt文件
[打印本页]
作者:
hackin
时间:
2010-7-10 22:32
标题:
apache和nginx下禁止访问txt文件
如下是关于Apache和Nginx 限制该类事情办法:
Apache:解决办法;
<Directory "/home/domain/public_html">
Options -Indexes FollowSymLinks
AllowOverride All
<Files ~ ".txt">
Order allow,deny
Deny from all
</Files>
</Directory>
Nginx:解决办法;
location ~* \.(txt|doc)$ {
if (-f $request_filename) {
root /home/domain/public_html/test;
break;
}
}
Nginx下请大家注意标点符号的使用,不要漏掉后面的“
;
”!
或者:
#location ~ /\.ht {
# deny all;
#} location ~* \.(txt|doc)${
root /home/domain/public_html/test;
deny all;
}
欢迎光临 VPS侦探论坛 (https://bbs.lnmp.com/)
Powered by Discuz! X3.4