Welcome to Centmin Mod Community
Register Now

Nginx Tracking 404 and 5xx errors?

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

  1. pamamolf

    pamamolf Well-Known Member

    2,821
    253
    83
    May 31, 2014
    Ratings:
    +447
    Local Time:
    1:39 AM
    Nginx-1.13.x
    MariaDB 10.1.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

    30,956
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,418
    Local Time:
    9:39 AM
    Nginx 1.13.x
    MariaDB 5.5
    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 Well-Known Member

    2,821
    253
    83
    May 31, 2014
    Ratings:
    +447
    Local Time:
    1:39 AM
    Nginx-1.13.x
    MariaDB 10.1.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

    30,956
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,418
    Local Time:
    9:39 AM
    Nginx 1.13.x
    MariaDB 5.5
    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
     
    • Agree Agree x 1
  5. pamamolf

    pamamolf Well-Known Member

    2,821
    253
    83
    May 31, 2014
    Ratings:
    +447
    Local Time:
    1:39 AM
    Nginx-1.13.x
    MariaDB 10.1.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

    30,956
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,418
    Local Time:
    9:39 AM
    Nginx 1.13.x
    MariaDB 5.5
    • Informative Informative x 1