我的配置有问题,我使用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禁止:
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;
}
检查您.conf文件,请确保自动索引已打开,否则会有此错误
autoindex on;