我的配置有问题,我使用的是nginx / 1.10.3,php5-fpm。
这是我的默认配置位置:
location / {
try_files $uri $uri/ =404;
allow 1.2.3.4; #my ip
allow 127.0.0.1;
allow 11.22.33.44; #server ip
deny all;
}
当我尝试访问11.22.33.44时,我有一个403 Forbidden:
2017/03/08 16:30:25 [error] 340#340: *3 access forbidden by rule, client: 1.2.3.4, server: _, request: "GET / HTTP/1.1", host: "11.22.33.44"
感谢您的帮助!
解决,解决方案:
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
allow 127.0.0.1;
allow 1.2.3.4; #my ip
deny all;
}
答案 0 :(得分:0)
检查.conf文件,确保自动索引已打开,否则会出现此错误
{{1}}