Discover Centmin Mod today
Register Now

Nginx nginx: [emerg] unknown "maintenance" variable

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

  1. pamamolf

    pamamolf Well-Known Member

    2,836
    253
    83
    May 31, 2014
    Ratings:
    +449
    Local Time:
    3:29 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    • CentOS Version: CentOS 6 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.13.7
    • PHP Version Installed:7.0.15
    • MariaDB MySQL Version Installed: 10.1.21
    • When was last time updated Centmin Mod code base ? : just now

    On Centos 6 (don't know if that issue exists also on Centos 7) after adding a new domain using menu option 2 with self signed certificate after the creation of the vhost i try to restart Nginx 1.13.7 and i got:

    and fails to restart :(

    But maintenance line is disabled at:

    /usr/local/nginx/conf/nginx.conf

    After trying a few edits i found that the issue is related to this:

    If i comment the include it works:

    503include-only.conf content:

    Thanks
     
  2. eva2000

    eva2000 Administrator Staff Member

    31,021
    6,924
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,430
    Local Time:
    11:29 AM
    Nginx 1.13.x
    MariaDB 5.5
    that's why you're getting the error as that include file is disabled while it should be enabled. You broke Centmin Mod's sitestatus maintenance mode feature by commenting out the include file /usr/local/nginx/conf/maintenance.conf in nginx.conf https://community.centminmod.com/threads/sitestatus-maintenance-mode.5599/

    recursive grep for word maintenance in /usr/local/nginx/conf shows 1st entry reporting include file for /usr/local/nginx/conf/maintenance.conf is enabled (uncommented) on line 56 of /usr/local/nginx/conf/nginx.conf
    Code (Text):
    grep -rn 'maintenance' /usr/local/nginx/conf
    /usr/local/nginx/conf/nginx.conf:56:include /usr/local/nginx/conf/maintenance.conf;
    /usr/local/nginx/conf/maintenance.conf:1:     # IPs you can whitelist from maintenance mode
    /usr/local/nginx/conf/maintenance.conf:14:     map $maint_whitelist$exclude_url $maintenance {
    /usr/local/nginx/conf/503include-main.conf:4:     error_page 503 @maintenance;
    /usr/local/nginx/conf/503include-main.conf:5:     location @maintenance {
    /usr/local/nginx/conf/503include-main.conf:6:          #if ($maintenance = 1) {
    /usr/local/nginx/conf/503include-main.conf:7:          rewrite ^ /maintenance.html break;
    /usr/local/nginx/conf/503include-main.conf:8:          #try_files /maintenance.html =503;
    /usr/local/nginx/conf/503include-only.conf:1:if ($maintenance = 1) { return 503; }
    
     
    • Informative Informative x 1
  3. pamamolf

    pamamolf Well-Known Member

    2,836
    253
    83
    May 31, 2014
    Ratings:
    +449
    Local Time:
    3:29 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    So if i have it enabled on main nginx config and disabled on domain vhost config it will not function?

    Or is it disabled by default anyway ?
     
    Last edited: Nov 23, 2017
  4. eva2000

    eva2000 Administrator Staff Member

    31,021
    6,924
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,430
    Local Time:
    11:29 AM
    Nginx 1.13.x
    MariaDB 5.5
    yes leave maintenance.conf include enabled in nginx.conf and just disable in vhost if you want to disable sitestatus maintenance mode
     
    • Informative Informative x 1