Want more timely Centmin Mod News Updates?
Become a Member

Nginx Chasing location directive issues

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by enderst, Jan 8, 2019.

  1. enderst

    enderst New Member

    25
    5
    3
    Dec 12, 2017
    Ratings:
    +8
    Local Time:
    11:18 PM
    Migrated two sites, first one went fine the second I'm getting the following error:
    Code:
    #nginx -t
    nginx: [emerg] "location" directive is not allowed here in /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.conf:3
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    
    If clear the file:
    Code:
    > /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.conf
    
    then I get:
    Code:
    # nginx -t
    nginx: [emerg] "location" directive is not allowed here in /usr/local/nginx/conf/503include-main.conf:5
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    
    Not sure if I'm going down a rabbit hole if I continue to clear the files.
     
  2. eva2000

    eva2000 Administrator Staff Member

    38,545
    8,501
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,066
    Local Time:
    3:18 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Most likely missing or extra ending or starting curly braces {} in your main nginx vhost throwing stuff out of wack.

    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
    Please post the contents of /usr/local/nginx/conf/conf.d/newdomain.com.conf and if applicable /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf wrapped in CODE tags (outlined at How to use forum BBCODE code tags)

    Where newdomain.com is your problem domain name.
     
    • Like Like x 1
  3. enderst

    enderst New Member

    25
    5
    3
    Dec 12, 2017
    Ratings:
    +8
    Local Time:
    11:18 PM
    Once again you saved some hair pulling.
    I had an extra brace where I pasted a redirect.
    Thanks.
     
    • Like Like x 1
..