Join the community today
Become a Member

Nginx Can't restart nginx

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Jon Snow, Aug 11, 2017.

  1. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:55 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    actually it's autoprotect include file
    Code (Text):
    /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf:24:location / {
    

    line 24 of /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf so you must of had a .htaccess file in web root of / which had deny all text in it ?


    If on Centmin Mod 123.09beta01, you may have ran into the new tools/autoprotect.sh cronjob feature outlined at Beta Branch - autoprotect.sh - apache .htaccess check & migration to nginx deny all | Centmin Mod Community You uploaded scripts may have .htaccess deny from all type files in their directories which may need bypassing autoprotect. It's a security feature that no other nginx based stack has as far as I know :)

    So instead, all .htaccess 'deny from all' detected directories now get auto generated Nginx equivalent location match and deny all setups except if you want to manually bypass the directory from auto protection via a .autoprotect-bypass file - details below here.

    You can read a few threads below on how autoprotect.sh may have caught some folks web apps falsely and the workarounds or improvements made to autoprotect.sh with the help of users feedback and troubleshooting.
     
  2. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:55 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    grep on shows matched text so no search for ending curly bracket
     
  3. Jon Snow

    Jon Snow Active Member

    917
    188
    43
    Jun 30, 2017
    Ratings:
    +293
    Local Time:
    8:55 PM
    Nginx 1.13.9
    MariaDB 10.1.31
    @eva2000 That was indeed the issue.

    I just renamed the htaccess file and ran the command. Is there anything I'm risking by doing this to make me have to set something up manually? Or am I fine?
     
  4. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:55 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    depends what the contents of that .htaccess was
     
  5. Jon Snow

    Jon Snow Active Member

    917
    188
    43
    Jun 30, 2017
    Ratings:
    +293
    Local Time:
    8:55 PM
    Nginx 1.13.9
    MariaDB 10.1.31
    It's just a simple wordpress site.

    Normally I add things to - /usr/local/nginx/conf/conf.d/domain.com.conf
     
  6. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:55 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    If it's wordpress it usually doesn't have a .htaccess file in web root ? If yours does, just manually bypass the directory from auto protection via a .autoprotect-bypass file - details below here. If it ain't the norm, then delete the .htaccess file as it isn't used in nginx anyway.
     
  7. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    1:55 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    I was refering to this part of code.
    I copy/paste in editor and last bracket has not open one, but I realised that I copy just part of code, because opening bracket is on the beginning.

    Code (Text):
    # ngx_pagespeed & ngx_pagespeed handler
    # include /usr/local/nginx/conf/pagespeed.conf;
    # include /usr/local/nginx/conf/pagespeedhandler.conf;
    # include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      # add_header X-Frame-Options SAMEORIGIN;
      # add_header X-Xss-Protection "1; mode=block" always;
      # add_header X-Content-Type-Options "nosniff" always;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/domain.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/domain.com/log/error.log;
    
      root /home/nginx/domains/domain.com/public;
    
      location / {
        # Wordpress Permalinks
        try_files $uri $uri/ /index.php?q=$request_uri;
    
        include /usr/local/nginx/conf/wpsecure.conf;
        include /usr/local/nginx/conf/wpnocache.conf;
      }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      # include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
     
  8. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:55 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    I see :)
     
  9. pamamolf

    pamamolf Well-Known Member

    4,125
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    2:55 AM
    Nginx-1.29.x
    MariaDB 10.6.x
    The online vhost builder recommends the old value of flush=60m :(
     
  10. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:55 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    i updated that yesterday :D
     
  11. pamamolf

    pamamolf Well-Known Member

    4,125
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    2:55 AM
    Nginx-1.29.x
    MariaDB 10.6.x
    I just check it a few minutes ago for creation a non ssl vhost and was report 60m ....
     
  12. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:55 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    whoops committed the update locally haven't pushed it out the centminmod.com cluster yet :)
     
  13. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:55 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Just updated :D