Want more timely Centmin Mod News Updates?
Become a Member

Nginx ERR_TOO_MANY_REDIRECTS

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by FAPM, Aug 4, 2015.

  1. FAPM

    FAPM Member

    58
    4
    8
    Jul 16, 2015
    Ratings:
    +6
    Local Time:
    12:55 PM
    1.9.2
    10.0.20
    Hi ALL,

    I had a vhost conf operational on Centmin Mod 1.2.3 eva2000.07
    I proceeded to install Centmin Mod 1.2.3 eva2000.08
    The configuration no longer works.
    Should I make a change on my vhost configuration?
    "domain" is my domain
    I get eg ERR_TOO_MANY_REDIRECTS

    Code:
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    server {
                listen   80;
                server_name domain;
            return 302 https://$server_name$request_uri;
           }
    
    server {
    
              listen 443 ssl spdy; 
            server_name domain;
          
            root /home/nginx/domains/domain/public;
          
          
            access_log /home/nginx/domains/domain/log/access.log combined buffer=32k;
            error_log /home/nginx/domains/domain/log/error.log;
            
            
            ssl_dhparam /usr/local/nginx/conf/ssl/domain/dhparam.pem;
            ssl_certificate /usr/local/nginx/conf/ssl/domain/cert_fr-unified.crt;
            ssl_certificate_key /usr/local/nginx/conf/ssl/domain/cert_fr.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";
      
      
        # enable ocsp stapling
            resolver 8.8.8.8;
            ssl_stapling on;
            ssl_stapling_verify on;
            ssl_trusted_certificate /usr/local/nginx/conf/ssl/domain/ssl-trusted.crt;
      
        # Try static files first, then php  
          
    
            #PSHOP
            index index.html index.htm index.php;
            charset utf-8;
            rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
            rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2$3.jpg last;
            rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
            rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
            rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
            rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
            rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
            rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
            rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
            rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2$3.jpg last;
            rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last;
            rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last;
            rewrite ^/order$ /index.php?controller=order last;
      
                  
            if (!-e $request_filename){
            rewrite ^(.*)$ /index.php last;
            }  
      
          
            location / {
            try_files $uri $uri/ /index.php?q=$uri&$args;
               }
    
            #location /c {
                rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/p/$1$2$3.jpg last;
                rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/p/$1$2.jpg last;
               }
    
            #location /p {
                rewrite ^/p/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/p/$1$2$3.jpg last;
                rewrite ^/p/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/p/$1$2.jpg last;
               }
    
            #location /images_ie {
                rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last;
               }
    
            # Don't log robots.txt or favicon.ico files
            location ~* ^/(favicon.ico|robots.txt)$ {
            access_log off;
            log_not_found off;
               }
    
            # Custom 404 page
            error_page 404 /index.php?controller=404;
    
            # Deny access to .htaccess
            location ~ /\.ht {
            deny all;
               }
    
            # Block everything else in these directories
            location ~ ^/(admin/backups|admin/export|admin/import|admin/tabs|classes|config|docs|download|localization|log|override|tools|translations)/ {
            deny all;
               }
    
            # Block all files with these extensions
            location ~ \.(md|tpl)$ {
            deny all;
            }
    
            # Directories explicitly allowed in directories blocked below
            location ~ ^/docs/csv_import/ {
            allow all;
            }
      
            #COMCAR CSS
            location /css {
                concat on;
                concat_max_files 20;
            add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
                }
      
            #COMCAT JS
            location /js {
                concat on;
                concat_max_files 20;
            add_header Pragma private;
            add_header Cache-Control "private, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
                }
    
            #location /home/nginx/domains/domain/public {
                location ~*\.(jpg|jpeg|gif|png|js|css)$ {
                add_header Cache-Control"public, max-age=600";
              }
     
    
      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/vts_server.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      #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;
    
    
    }
    Thx ALL
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,155
    6,783
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,134
    Local Time:
    8:55 PM
    Nginx 1.13.x
    MariaDB 5.5
    was this an upgrade as per instructions at Upgrade Centmin Mod - CentminMod.com LEMP Nginx web stack for CentOS

    or was this a fresh install as per Download - CentminMod.com LEMP Nginx web stack for CentOS and then you moved your site and config files over to fresh install ?

    did you create the new vhost for your fresh install via centmin.sh menu option 2 or /usr/bin/nv and select yes to create self-signed SSL Nginx Vhost & NSD DNS Setup - CentminMod.com LEMP Nginx web stack for CentOS ? if you did you would of gotten a 2nd nginx vhost file at /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf which is self-signed ssl version which maybe conflicting with your non-ssl config /usr/local/nginx/conf/conf.d/newdomain.com.conf which may have your above ssl configurations.

    you can try just renaming /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf to /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf-disabled and restarting nginx server
     
  3. FAPM

    FAPM Member

    58
    4
    8
    Jul 16, 2015
    Ratings:
    +6
    Local Time:
    12:55 PM
    1.9.2
    10.0.20
    Hi eva2000,

    Fresh install and vhost conf (option 2) (no self-signed i have a certificate ssl thawte)
     
    Last edited: Aug 4, 2015
  4. FAPM

    FAPM Member

    58
    4
    8
    Jul 16, 2015
    Ratings:
    +6
    Local Time:
    12:55 PM
    1.9.2
    10.0.20
    I have only one file : newdomain.com.conf
     
  5. eva2000

    eva2000 Administrator Staff Member

    30,155
    6,783
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,134
    Local Time:
    8:55 PM
    Nginx 1.13.x
    MariaDB 5.5
    then i can't see why you'd have that error if it's just a drop in replacement for your nginx site domain vhost file provided it was working fine prior to the switch to newer Centmin Mod version
     
  6. FAPM

    FAPM Member

    58
    4
    8
    Jul 16, 2015
    Ratings:
    +6
    Local Time:
    12:55 PM
    1.9.2
    10.0.20
    SOLVED ... PRESTASHOP ...
     
    • Like Like x 1