Join the community 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

    29,720
    6,711
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,015
    Local Time:
    7:49 PM
    Nginx 1.13.x
    MariaDB 5.5
    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

    29,720
    6,711
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,015
    Local Time:
    7:49 PM
    Nginx 1.13.x
    MariaDB 5.5
    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;
    }