Want more timely Centmin Mod News Updates?
Become a Member

X-Cart Configuration Files for Nginx

Discussion in 'Ecommerce / Shopping cart usage' started by ljseals, Dec 21, 2016.

Tags:
  1. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    8:24 PM
    Greetings, I am placing these files for X-Cart. They were made by Clever at the X-Cart Forum link https://forum.x-cart.com/showthread.php?t=73118&highlight=nginx.

    This is what he said:
    However, X-Cart has given the following code with the warning to make sure the unix socket is correct :
    Code:
    location / {
       try_files $uri $uri/ @xc5;
       index cart.php index.php;
    }
    
    location ~ \.php$ {
       fastcgi_pass   unix:/var/run/php/php7.0-fpm.sock;
       fastcgi_index  home.php;
       include fastcgi_params;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    
    location @xc5 {
       if ( $uri ~ "^/((([/_a-zA-Z0-9-]+)/)?([_a-zA-Z0-9-]+)/)?([_a-zA-Z0-9-]+)(/?)(\.([_a-zA-Z0-9-]+))?$" ) {
          set $rurl $5;
          set $rlast $4;
          set $rrest $3;
          set $rext $7;
    
          rewrite ^ /cart.php?url=$rurl&last=$rlast&rest=$rrest&ext=$rext last;
       }
    }
    Please keep in mind that I have absolutely no clue in what I am doing in regard to nginx or for that matter centmin mod; however, I believe that through the Lord's help I will be able to make it work. Please keep in mind that I have not gotten to this step but am placing it here just in case anyone may need it.

    P.S. X-Cart is an extremely good shopping cart and you should check it out! God bless you!

     

    Attached Files:

  2. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    11:24 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    As you'll need to have https/ssl for shopping cart you'd want to enable letsencrypt ssl addons/acmetool.sh in 123.09beta01

    but you can also manually do it via vhost generator at Generate Centmin Mod Nginx Vhost - CentminMod.com LEMP Nginx web stack for CentOS just check the ssl box and input a domain name and follow instructions to enable letsencrypt ssl including setting LETSENCRYPT_DETECT='Y' in persistent config file /etc/centminmod/custom_config.inc and running 3 sets of SSH commands to obtain letsencrypt ssl certificate. Be sure to have already before hand updated domain's DNS A record to point to server ip address at least 24-72hrs before hand for letsencrypt domain validation.

    i.e. for domain.com the vhost generator would give you the following nginx vhost file at /usr/local/nginx/conf/conf.d/domain.com.ssl.conf

    containing the following if you followed the letsencryt ssl manual steps on vhost generator page

    Code (Text):
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For HTTP/2 SSL Setup
    # read http://centminmod.com/nginx_configure_https_ssl_spdy.html
    
    # redirect from www to non-www  forced SSL
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    # server {
    #   server_name domain.com www.domain.com;
    #    return 302 https://domain.com$request_uri;
    # }
    
    server {
      listen 443 ssl http2;
      server_name domain.com www.domain.com;
    
      ssl_dhparam /usr/local/nginx/conf/ssl/domain.com/dhparam.pem;
      ssl_certificate      /usr/local/nginx/conf/ssl/domain.com/domain.com-acme.cer;
      ssl_certificate_key  /usr/local/nginx/conf/ssl/domain.com/domain.com-acme.key;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      # dual cert supported ssl ciphers
      ssl_ciphers     EECDH+CHACHA20-draft:EECDH+CHACHA20:EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+ECDSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+SHA384:EECDH+AES128:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
     
      # enable ocsp stapling
      resolver 8.8.8.8 8.8.4.4 valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
      ssl_trusted_certificate /usr/local/nginx/conf/ssl/domain.com/domain.com-acme.cer;
    
    # 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;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/domain.com/log/access.log combined buffer=256k flush=60m;
      error_log /home/nginx/domains/domain.com/log/error.log;
    
      root /home/nginx/domains/domain.com/public;
    
      location / {
    
    # 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;
    
      # Enable for vBulletin usage WITHOUT vbSEO installed
      # More example Nginx vhost configurations at
      # http://centminmod.com/nginx_configure.html
      #try_files    $uri $uri/ /index.php;
    
      }
    
      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;
    }

    You'll need to modify the nginx vhost domain.com.ssl.conf to

    1. force redirect http to https
    2. add x-cart config rules

    for force redirect http to https in domain.com.ssl.conf change the top portion from
    Code (Text):
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For HTTP/2 SSL Setup
    # read http://centminmod.com/nginx_configure_https_ssl_spdy.html
    
    # redirect from www to non-www  forced SSL
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    # server {
    #   server_name domain.com www.domain.com;
    #    return 302 https://domain.com$request_uri;
    # }
    

    to
    Code (Text):
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For HTTP/2 SSL Setup
    # read http://centminmod.com/nginx_configure_https_ssl_spdy.html
    
    # redirect from www to non-www  forced SSL
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
     server {
       server_name domain.com www.domain.com;
        return 302 https://domain.com$request_uri;
     }
    

    that will force http to https at domain.com without www

    now for x-cart rules, I have never used x-cart so just transposing rules into domain.com.ssl.conf nginx vhost

    Code (Text):
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For HTTP/2 SSL Setup
    # read http://centminmod.com/nginx_configure_https_ssl_spdy.html
    
    # redirect from www to non-www  forced SSL
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
     server {
       server_name domain.com www.domain.com;
        return 302 https://domain.com$request_uri;
     }
    
    server {
      listen 443 ssl http2;
      server_name domain.com www.domain.com;
    
      ssl_dhparam /usr/local/nginx/conf/ssl/domain.com/dhparam.pem;
      ssl_certificate      /usr/local/nginx/conf/ssl/domain.com/domain.com-acme.cer;
      ssl_certificate_key  /usr/local/nginx/conf/ssl/domain.com/domain.com-acme.key;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      # dual cert supported ssl ciphers
      ssl_ciphers     EECDH+CHACHA20-draft:EECDH+CHACHA20:EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+ECDSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+SHA384:EECDH+AES128:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
    
      # enable ocsp stapling
      resolver 8.8.8.8 8.8.4.4 valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
      ssl_trusted_certificate /usr/local/nginx/conf/ssl/domain.com/domain.com-acme.cer;
    
    # 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;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/domain.com/log/access.log combined buffer=256k flush=60m;
      error_log /home/nginx/domains/domain.com/log/error.log;
    
      root /home/nginx/domains/domain.com/public;
    
    location / {
      try_files $uri $uri/ @xc5;
       index cart.php index.php;
    }
    
    location @xc5 {
      if ( $uri ~ "^/((([/_a-zA-Z0-9-]+)/)?([_a-zA-Z0-9-]+)/)?([_a-zA-Z0-9-]+)(/?)(\.([_a-zA-Z0-9-]+))?$" ) {
          set $rurl $5;
          set $rlast $4;
          set $rrest $3;
          set $rext $7;
    
          rewrite ^ /cart.php?url=$rurl&last=$rlast&rest=$rrest&ext=$rext last;
       }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php_xcart.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }

    The .php location unix socket is not needed as Centmin Mod adds a default include file for it at /usr/local/nginx/conf/php.conf however as your .php location is further customised with home.php index you can't exactly use /usr/local/nginx/conf/php.conf as it's a global include file added to all nginx vhosts on Centmin Mod

    so make a copy of /usr/local/nginx/conf/php.conf named /usr/local/nginx/conf/php_xcart.conf via ssh command line type
    Code (Text):
    cp -a /usr/local/nginx/conf/php.conf /usr/local/nginx/conf/php_xcart.conf
    

    and notice above custom domain.com.ssl.conf I have included it
    Code (Text):
      include /usr/local/nginx/conf/php_xcart.conf;
    

    now edit /usr/local/nginx/conf/php_xcart.conf via nano or vim linux text editor - nano which you can read up more about nano here and here. For vim text editor read here and here.

    and change 3 lines in php_xcart.conf from
    Code (Text):
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME    $request_filename;

    To
    Code (Text):
        fastcgi_index  home.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        #fastcgi_param  SCRIPT_FILENAME    $request_filename;

    then restart nginx and php-fpm
    Code (Text):
    service nginx restart
    service php-fpm restart
    

    or via command shortcut faq item 16 listed
    Code (Text):
    nprestart


    Above doesn't include those attachment custom nginx rules though that would be more extensive modifications, probably best to see how x-cart provided rules goes first
     
  3. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    8:24 PM
    Oh my, does not seem so overwhelming now. I corrected the hostname and went to do a virtual host but I did not choose to sign the ssl as I already purchased one so I made a a csr and private key at Online CSR Generator from GoGetSSL. Generate CSR now! I will have to read more up on it but I was waiting for my e-mail to show up but it never did. However, that is because I setup the mail server from mailgun to gmail but my domain name server did not verify in time so I was waiting on that.

    I tried Zoho but it seemed slow but after reading about the Mailgun to Gmail hack I decided to give it a try, the article is here. Also reading how to inject the sql in the mariadb while I had time. I thank the Lord for touching your heart to help me. I believe that through the Lord's help my site should be up and running shortly. Thanks again!
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    11:24 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  5. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    8:24 PM
    For clarification it seems that with the new release of their software X-cart has updated their Nginx configuration files. For anyone watching this thread. The link is here.

    Code:
    ## Example nginx configuration
    location / {
      index cart.php;
    
      if (!-e $request_filename){
         rewrite ^/sitemap.xml(\?.+)?$ /cart.php?target=sitemap;
         rewrite ^/((([/_A-Za-z0-9-]+)/)?([_A-Za-z0-9-]+)/)?([_A-Za-z0-9-]+)(/?)(\.([_A-Za-z0-9-]+))?$ /cart.php?url=$5&last=$4&rest=$3&ext=$7 last;
      }
    }
    
    Code:
    ## Example nginx configuration (X-Cart 5.3.2+)
    location @handler {
            index cart.php;
    
            rewrite ^/sitemap.xml(\?.+)?$ /cart.php?target=sitemap;
            rewrite ^/(.*)$ /cart.php?url=$1 last;
    }
    
    location / {
            try_files $uri $uri/ @handler;
    }
    
    location ~ \.php$ {
            try_files $uri @handler;
            
            # be careful about your fastcgi params, don't let duplicate try_files
    }
    
     
  6. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    8:24 PM
    Greetings I am using the latest .09 beta branch that for my online store. The mod increases the loading time dramatically but I have a problem.

    Code (Text):
    yum -y update; curl -O https://centminmod.com/betainstaller-latest.sh && chmod 0700 betainstaller-latest.sh && bash betainstaller-latest.sh
    


    First I am getting a notice in error logs:
    Code (Text):
    2016/12/23 23:46:11 [error] 12142#12142: *11 FastCGI sent in stderr: "PHP message: PHP Notice:  A non well formed numeric value encountered in /home/nginx/domains/onthecheap.store/public/Includes/functions.php on line 755


    I do not know if that is causing the issue but when I went to edit nginx vhost file it will cause an error and will allow views to download portions of my site that are supposed to be secured.
    I reinstalled nginx and php from the centmin mod. I also dropped the database and put fresh files in the directory. However, upon editing the vhost file again it crashed and allowed people to download the site upon entering. With the message application/octet-stream (224 bytes).

    Here is my log file at pastebin here.

    Also a copy of my revised ngnix file here:

    Code (Text):
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For HTTP/2 SSL Setup
    # read http://centminmod.com/nginx_configure_https_ssl_spdy.html
    
    # redirect from www to non-www  forced SSL
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
     server {
       server_name onthecheap.store www.onthecheap.store;
        return 302 https://onthecheap.store$request_uri;
     }
    
    server {
      listen 443 ssl http2;
      server_name onthecheap.store www.onthecheap.store;
    
            ssl_dhparam /usr/local/nginx/conf/ssl/onthecheap.store/dhparam.pem;
            ssl_certificate      /usr/local/nginx/conf/ssl/onthecheap.store/ssl-unified.crt;
            ssl_certificate_key  /usr/local/nginx/conf/ssl/onthecheap.store/onthecheap_store.key;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            ssl_session_cache      shared:SSL:10m;
            ssl_session_timeout  10m;
            ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA;
            ssl_prefer_server_ciphers   on;
            add_header Alternate-Protocol  443:npn-spdy/3;
            add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
            #add_header  X-Content-Type-Options "nosniff";
            #add_header X-Frame-Options DENY;
            # nginx 1.5.9+ or higher
            # http://nginx.org/en/docs/http/ngx_http_spdy_module.html#spdy_headers_comp
            # http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_buffer_size
            # spdy_headers_comp 0;
            # ssl_buffer_size 4k;
    
            # enable ocsp stapling
            resolver 8.8.8.8;
            ssl_stapling on;
            ssl_stapling_verify on;
            ssl_trusted_certificate /usr/local/nginx/conf/ssl/onthecheap.store/ssl-trusted.crt;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
    
    # 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;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/onthecheap.store/log/access.log combined buffer=32k;
      error_log /home/nginx/domains/onthecheap.store/log/error.log;
    
      root /home/nginx/domains/onthecheap.store/public;
    
    location @handler {
            index cart.php;
    
            rewrite ^/sitemap.xml(\?.+)?$ /cart.php?target=sitemap;
            rewrite ^/(.*)$ /cart.php?url=$1 last;
    }
    
    location / {
            try_files $uri $uri/ @handler;
    }
    
    location ~ \.php$ {
            try_files $uri @handler;
            
            # be careful about your fastcgi params, don't let duplicate try_files
    }
    
      include /usr/local/nginx/conf/staticfiles_xcart.conf;
      include /usr/local/nginx/conf/php_xcart.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
     
  7. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    11:24 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    xenforo issue probably or php 7 incompatibility with your script, try downgrading to php 5.6.29
    problem for you though is this doesn't work as you overlaps with /usr/local/nginx/conf/php_xcart.conf include file

    Code (Text):
    location / {
            try_files $uri $uri/ @handler;
    }
    
    location ~ \.php$ {
            try_files $uri @handler;
        
            # be careful about your fastcgi params, don't let duplicate try_files
    }

    try removing this line
    Code (Text):
    location ~ \.php$ {
            try_files $uri @handler;
        
            # be careful about your fastcgi params, don't let duplicate try_files
    }
    

    add this to domain.com.conf
    Code (Text):
    location @handler {
           index cart.php;
    
            rewrite ^/sitemap.xml(\?.+)?$ /cart.php?target=sitemap;
            rewrite ^/(.*)$ /cart.php?url=$1 last;
    }
    

    and place
    Code (Text):
    try_files $uri @handler;
    

    in /usr/local/nginx/conf/php_xcart.conf replacing these lines
    Code (Text):
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    if (!-f $document_root$fastcgi_script_name) {
    return 404;
    }
    
     
  8. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    11:24 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    oh you're missing
    Code (Text):
    location @handler {
           index cart.php;
    
            rewrite ^/sitemap.xml(\?.+)?$ /cart.php?target=sitemap;
            rewrite ^/(.*)$ /cart.php?url=$1 last;
    }
    
     
  9. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    8:24 PM
    Greetings Eva,

    I cannot get the code to work right with the new code.

    Code (Text):
    location @handler {
            index cart.php;
    
            rewrite ^/sitemap.xml(\?.+)?$ /cart.php?target=sitemap;
            rewrite ^/(.*)$ /cart.php?url=$1 last;
    }
    
    location / {
            try_files $uri $uri/ @handler;
    }
    
    location ~ \.php$ {
            try_files $uri @handler;
            
            # be careful about your fastcgi params, don't let duplicate try_files
    }


    I thank the Lord for touching your heart to help but it did not work. I try troubleshooting as best as I can and through the grace of God I got it to show up but I would prefer to have this implement corrected as not to cause further bugs in the software. Also I am willing to pay you as I would like to have it as stable as I can so that I do not have to do much. X-Cart is fine with PHP 7 but the company has been working through a few bug issues.

    The performance of this web stack is amazing! I only came to find out about a few days ago. However look at this perfomance. As tested the TTFB was an amazing 0.305s; reaching 0.285s on the second view;and the total load time was 1.890s. You can check out the results below:

    WebPagetest Test Result - Dulles : www.onthecheap.store/ - 12/23/16 09:32:19

    That is amazing! Not only that it has procedures and protocols in this stack to help https:// those are some unheard of numbers as the https: has to make two round trips I think. At any rate it is a super mod, I thank the Lord for touching your heart to make it. God bless you!
     
  10. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    11:24 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    re-read post #7 about removing specific .php location context

    As expected, Centmin Mod LEMP stack has always been about performance + security - but performance is my addiction :)
     
  11. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    8:24 PM
    I tried it but it gave me an error... I will try it again but I was tinkering with preloading seeing if the times would get even lower but now the static pages gives a 404 error. Is this a coincidence? The code I changed

    Code (Text):
    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";

    To
    Code (Text):
    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; Preload";
     
  12. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    11:24 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    no do not preload !!! makes it hard to switch between https and http if you want to go back as removal is alot more difficult from google database HSTS Preloading

    what errors, the rest is up to you to figure out though as i never used x-cart so can't really help
     
  13. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    8:24 PM
    Thanks! God bless you!
     
  14. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    8:24 PM
    This is the error:

    Code (Text):
    nginx.service - SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server
       Loaded: loaded (/etc/rc.d/init.d/nginx; bad; vendor preset: disabled)
       Active: failed (Result: exit-code) since Sat 2016-12-24 10:33:17 UTC; 12s ago
         Docs: man:systemd-sysv-generator(8)
      Process: 2988 ExecStop=/etc/rc.d/init.d/nginx stop (code=exited, status=0/SUCCESS)
      Process: 2995 ExecStart=/etc/rc.d/init.d/nginx start (code=exited, status=1/FAILURE)
     Main PID: 2814 (code=exited, status=0/SUCCESS)
    
    Dec 24 10:33:17 srv1.onthecheap.store systemd[1]: Starting SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server...
    Dec 24 10:33:17 srv1.onthecheap.store nginx[2995]: Starting nginx: nginx: [emerg] "fastcgi_pass" directive is not allowed here in /usr/local/nginx/conf/php_xcart.conf:3
    Dec 24 10:33:17 srv1.onthecheap.store systemd[1]: nginx.service: control process exited, code=exited status=1
    Dec 24 10:33:17 srv1.onthecheap.store nginx[2995]: [FAILED]
    Dec 24 10:33:17 srv1.onthecheap.store systemd[1]: Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.
    Dec 24 10:33:17 srv1.onthecheap.store systemd[1]: Unit nginx.service entered failed state.
    Dec 24 10:33:17 srv1.onthecheap.store systemd[1]: nginx.service failed.
    Hint: Some lines were ellipsized, use -l to show in full.
    [root@srv1 ~]# fastcgi_pass" directive is not allowedfastcgi_pass" directive is not allowed
    
     
  15. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    8:24 PM
    This had to do with me deleting the location variable in pp_xcart. God bless you!
     
  16. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    11:24 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    nice to see you sorted it out :)
     
  17. rdan

    rdan Well-Known Member

    5,439
    1,398
    113
    May 25, 2014
    Ratings:
    +2,187
    Local Time:
    9:24 AM
    Mainline
    10.2
    What adjustment should I do to the config if it resides on a sub folder and xenforo on the root?

    Will it be?
    Code:
    ### Start Cart
    location /store/ {
           try_files $uri $uri/ @handler;
    
        location @handler {
            index cart.php;
    
            rewrite ^/sitemap.xml(\?.+)?$ /cart.php?target=sitemap;
            rewrite ^/(.*)$ /cart.php?url=$1 last;
        }
        include /usr/local/nginx/conf/php_xcart.conf;
    }
        ### End Cart