大网数据广告活动
服务器运维问答

Nginx says 404 not found, no error log

· 52CE 我爱测

I am getting a 404 not found at nginx page, i get no error in nginx error log file too. server { listen 6269; server_name (domain); root /home/temp; index /_h5ai/public/index.php; location / { try_files $uri $uri/ =404; autoindex…

问题原文

原帖链接 · Sid · CC BY-SA 4.0

I am getting a 404 not found at nginx page, i get no error in nginx error log file too.

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;
    } 
}
  • error.log is empty
  • access .log has:

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" "-"

  • OS: Fedora 29

社区高分解答

原帖链接 · Tero Kilkanen · CC BY-SA 4.0

nginx uses error as the default log level for error_log. This logging level does not output anything to the error log in case of 404 responses, since those are trivial errors in the scope of web server operation.

You can try changing the log level by using either warn, notice, info or debug in your error_log directive, for example:

error_log /var/log/nginx/error.log notice;

warn outputs a bit more information than error, notice a bit more than warn. debug produces most detailed output.

With your configuration, you need to have the following file for the GET / request to work:

/home/temp/_h5ai/public/index.php

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-11-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。