Join the community today
Become a Member

Nginx Tracking 404 and 5xx errors?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pamamolf, Feb 23, 2017.

  1. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    2:58 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    I want to track 404 and 50x errors.....

    Is this the correct file to look for them?


    Code:
    /usr/local/nginx/logs/error.log
    or

    Code:
    /home/nginx/domains/domainname.com/log/error.log
    ?
     
  2. eva2000

    eva2000 Administrator Staff Member

    54,909
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:58 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    nginx access logs and depends site specific use 2nd path - check your nginx site's vhost access_log and error_log paths

    for main hostname's vhost config at virtual.conf
    Code (Text):
    grep _log /usr/local/nginx/conf/conf.d/virtual.conf 
            access_log              /var/log/nginx/localhost.access.log     main buffer=256k flush=5m;
            error_log               /var/log/nginx/localhost.error.log      error;
            access_log   off;
    
     
  3. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    2:58 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Sorry for my bad english but i got confused....

    So you mean to check this one ?

    Code:
    /home/nginx/domains/mydomain.com/log/error.log
     
    Last edited: Feb 23, 2017
  4. eva2000

    eva2000 Administrator Staff Member

    54,909
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:58 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    When you create a new nginx vhost domain via centmin.sh menu option 2 or menu option 22 or via /usr/bin/nv cli command line, you will create the Nginx vhost files and directories. You will get an outputted the path location where it will create the domain name's vhost conf file named newdomain.com.conf (and newdomain.com.ssl.conf if you selected yes to self signed SSL)
    • Nginx vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.conf
    • Nginx HTTP/2 SSL vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
    • Nginx Self-Signed SSL Certificate Directory at /usr/local/nginx/conf/ssl/newdomain.com
    • Vhost public web root will be at /home/nginx/domains/newdomain.com/public
    • Vhost log directory will be at /home/nginx/domains/newdomain.com/log
    check your access_log and error_log paths outlined in site vhost files /usr/local/nginx/conf/conf.d/newdomain.com.conf and if applicable /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
     
  5. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    2:58 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Ok got it but i was confused as you told me to check both access and error log files and it was confusing for me as i was expect to have that kind of errors at one file only and the obvious one is the error log file....

    Also is the "warn" enough to get logged that kind of errors?

    Code:
    error_log   logs/error.log warn;
     
  6. eva2000

    eva2000 Administrator Staff Member

    54,909
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:58 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+