我是 nginx 新手,我尝试实现一个网络服务器并访问 index.php。如果我尝试访问 index.php nginx 会返回 404 错误。
这是我启用站点的配置:
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www/ilias;
index index.php;
#access_log /var/log/nginx/example.com.access.log;
#error_log /var/log/nginx/example.com.error.log;
access_log /var/log/nginx/ilias.access.log;
error_log /var/log/nginx/ilias.error.log;
client_max_body_size 100M;
autoindex off;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
include fastcgi_params;
fastcgi_intercept_errors on;
}
}
我没有看到错误,至少它应该向我显示 index.php