4

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
alexander.polomodov
  • 1,068
  • 3
  • 10
  • 14
Sid
  • 63
  • 1
  • 1
  • 4
  • Hi, does your client request hit the correct web server ? – yagmoth555 Nov 17 '18 at 21:57
  • @yagmoth555 I this so.. Using IP:6269 for accessing and no other server is listening to it, this is the only block except the default one – Sid Nov 17 '18 at 22:05

1 Answers1

5

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
Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • 4
    good answer, but you did not clarify which exact level logs the 404 error – João Pimentel Ferreira Jul 22 '20 at 18:56
  • 1
    For those wondering: `debug` gives you enough detail that you can, with some scrolling, eventually identify a 404. But it doesn't raise the 404s as it's own log entry... rather it logs, in detail, every request, including all the routing that went into it, eventually leading to the conclusion that the response will need to be a 404. – Laef Sep 18 '22 at 02:35