I use nginx 1.10.1, PHP 5.4.16 (fpm-fcgi).
My files' location is /usr/share/nginx/html/lab/. In this dir, there are multiple .php files, include index.php.
If I put a index.html file in this dir, I can see index.html's content from http://192.168.201.210:8024/lab/ correctly. But If I delete index.html file, I can only get 403 Forbidden.
My php-fam works well, and I saw a lot of solutions not works for me:
Can't open index.php by default with nginx
https://serversforhackers.com/video/php-fpm-configuration-the-listen-directive
This is my nginx's configuration file:
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
server {
listen 8024; # default_server;
# listen [::]:8024 ipv6only=on default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
location ~* \.php$ {
try_files $uri $uri/ = 404;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
index index.php index.html;
}
}
}
index index.php) in your catch alllocation /?