Discover Centmin Mod today
Register Now

PHP-FPM why get a redirect loop

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by ahmed, May 9, 2017.

  1. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    1:59 PM
    Code:
    server {
    listen 127.0.0.1:8080;
       server_name DOMAIN www.DOMAIN;
    #http2_max_field_size 16k;
     # http2_max_header_size 32k;
    
      root /home/nginx/domains/DOMAIN/public;
       index index.php;
       port_in_redirect off;
    
       location / {
          try_files $uri $uri/ /index.php?$args;
       }
    
      include /usr/local/nginx/conf/staticfiles.conf;
    
    #a trial to include more php
    ####include /usr/local/nginx/conf/php-wpsc.conf;
    
     location ~ \.php$ {
     try_files $uri =404;
         fastcgi_split_path_info ^(.+\.php)(/.+)$;
           include fastcgi_params;
          fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           fastcgi_param HTTPS on;
    
            fastcgi_pass 127.0.0.1:9000;
    }
    }
    
    THhe above server block which is the back end of varnoish works fine, do I need to put more security on it?
    any way I tried to include the php-wpsc.conf; but I get "redirect loop"

     
  2. eva2000

    eva2000 Administrator Staff Member

    50,901
    11,799
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,255
    Local Time:
    9:59 PM
    Nginx 1.25.x
    MariaDB 10.x
    remove
    Code (Text):
     location ~ \.php$ {
     try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
          include fastcgi_params;
         fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param HTTPS on;
    
           fastcgi_pass 127.0.0.1:9000;
    }
    

    that is already contained in /usr/local/nginx/conf/php-wpsc.conf or /usr/local/nginx/conf/php.conf
     
  3. ahmed

    ahmed Active Member

    361
    49
    28
    Feb 21, 2017
    Ratings:
    +63
    Local Time:
    1:59 PM
    yes, that what I did, I commented it using #

    however getting the loop
     
  4. eva2000

    eva2000 Administrator Staff Member

    50,901
    11,799
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,255
    Local Time:
    9:59 PM
    Nginx 1.25.x
    MariaDB 10.x
    then redirect loop is related to something else

    Centmin Mod is provided as is, so as you have varnish in front, you'd have diagnose where the redirect loop is coming from yourself