Sid*_*Sid 4 php nginx fedora php-fpm
我在 nginx 页面上找不到 404,我在 nginx 错误日志文件中也没有收到任何错误。
server {
listen 6269;
server_name (domain);
root /home/temp;
index /_h5ai/public/index.php;
location / {
try_files $uri $uri/ =404;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
location ~* \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
}
}
Run Code Online (Sandbox Code Playgroud)
X.0.X.190 - - [17/Nov/2018:21:50:57 +0000] "GET / HTTP/1.1" 404 571 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36" "-"
nginx 使用error
作为默认日志级别error_log
。如果出现 404 响应,此日志记录级别不会向错误日志输出任何内容,因为这些错误在 Web 服务器操作范围内是微不足道的。
您可以尝试在指令中使用warn
、notice
或info
来更改日志级别,例如:debug
error_log
error_log /var/log/nginx/error.log notice;
Run Code Online (Sandbox Code Playgroud)
warn
输出的信息比 多一点error
,notice
比 多一点warn
。debug
产生最详细的输出。
根据您的配置,您需要具有以下文件才能使GET /
请求正常工作:
/home/temp/_h5ai/public/index.php
Run Code Online (Sandbox Code Playgroud)