Learn about Centmin Mod LEMP Stack today
Register Now

Beta Branch add VHOST_PRESTATICINC='y' additional include files

Discussion in 'Centmin Mod Github Commits' started by eva2000, Jul 2, 2017.

  1. eva2000

    eva2000 Administrator Staff Member

    53,154
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    3:26 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    add VHOST_PRESTATICINC='y' additional include files

    - For newly created nginx vhosts only. For existng vhosts, would need to add them manually and create the include files themselves for /usr/local/nginx/conf/pre-staticfiles-global.conf and local /usr/local/nginx/conf/pre-staticfiles-local-domain.com.conf where domain.com is your vhost domain name.
    - In nginx vhost templates add 2 additional include files above /usr/local/nginx/conf/staticfiles.conf include file for a global include file /usr/local/nginx/conf/pre-staticfiles-global.conf and local /usr/local/nginx/conf/pre-staticfiles-local-domain.com.conf where domain.com is your vhost domain name. Allows you to add additional nginx rules that would go between default web root location / {} context and /usr/local/nginx/conf/staticfiles.conf. This is NOT for rules that are meant for web root location / {} context.

    Code (Text):
      include /usr/local/nginx/conf/pre-staticfiles-local-domain.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
    


    Continue reading...

    123.09beta01 branch


     
  2. eva2000

    eva2000 Administrator Staff Member

    53,154
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    3:26 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    example for full /usr/local/nginx/conf/conf.d/newdomain.com.conf
    Code (Text):
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www 
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name newdomain.com;
    #            return 301 $scheme://www.newdomain.com$request_uri;
    #       }
    
    server {
     
      server_name newdomain.com www.newdomain.com;
    
    # 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/newdomain.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/newdomain.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/newdomain.com/autoprotect-newdomain.com.conf;
      root /home/nginx/domains/newdomain.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      # prevent access to ./directories and files
      #location ~ (?:^|/)\. {
      # deny all;
      #}
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Wordpress Permalinks example
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      }
    
      include /usr/local/nginx/conf/pre-staticfiles-local-newdomain.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.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;
    }
    
     
  3. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    7:26 AM
    Hello, can u explain more, please?
     
  4. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    7:26 AM
    Hello, can u explain more, please?
     
  5. rdan

    rdan Well-Known Member

    5,439
    1,397
    113
    May 25, 2014
    Ratings:
    +2,186
    Local Time:
    1:26 PM
    Mainline
    10.2
    What is the usage of this by the way?
    Why included and created by default when it's empty?
     
  6. eva2000

    eva2000 Administrator Staff Member

    53,154
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    3:26 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    as per 1st post of this thread ;)