这是我的代码:
# I had to do this one because going .com/restricted was throwing 403, not 404.
location /restricted {
return 404;
}
#This seemed to work except I don't want localhost to have 404, I want it to access correctly
location ~ /restricted/(.+)\.php$ {
deny all;
return 404;
allow 127.0.0.1;
}
所以,基本上:
/restricted/should_be_restricted_script.php
)should_be_restricted_script.php
,我无法弄清楚为什么... 有人能帮助我吗? tyvm
答案 0 :(得分:0)
我认为您应该替换deny
和allow
行,因为第一场比赛将适用:
location ~ /restricted/(.+)\.php$ {
allow 127.0.0.1;
deny all;
}