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 {
# denyall;
#} location ~* \.(txt|doc)${
root /home/domain/public_html/test;
deny all;
}
页:
[1]