Want more timely Centmin Mod News Updates?
Become a Member

Amember nginx rewrite rules not working at Centminmod because of @php rule

Discussion in 'Other Web Apps usage' started by pamamolf, Jan 21, 2019.

  1. pamamolf

    pamamolf Premium Member Premium Member

    3,806
    369
    83
    May 31, 2014
    Ratings:
    +711
    Local Time:
    2:14 AM
    Nginx-1.17.x
    MariaDB 10.3.x
    Hello

    I am trying to make the Amember Pro script to work on Centminmod...

    It requires to set at the config the:

    Code:
           location ~* ^/amember/.*\.(js|ico|gif|jpg|png|css|swf|csv)$ {}
           location ~* ^/amember/setup/index.php$ { try_files not-existing-file @php; }
           location ~* ^/amember/js.php { try_files not-exiting-file @php; }
           location ~* ^/amember/index.php$ { try_files not-existing-file @php; }
           location ~* ^/amember/public.php$ { try_files not-existing-file @php; }
    
           location ~* ^/amember/public { rewrite ^.*$ /amember/public.php; }
           location ~* ^/amember/setup { rewrite ^.*$ /amember/setup/index.php; }
           location ~* ^/amember { rewrite ^.*$ /amember/index.php; }
    
           location ~ \.php$ {
                   try_files not-existing-file @php;
           }
    
           location @php {
    
                   fastcgi_pass  127.0.0.1:9000;
                   include        /etc/nginx/fastcgi_params;
                   fastcgi_param  SCRIPT_FILENAME  /var/www/nginx-default/$fastcgi_script_name;
    
           }
    another user report that this also works:

    Code:
    location ~ \.php$ {
       try_files not-existing-file @php;
    }
    
    location @php {
      fastcgi_pass 127.0.0.1:9000;
      include fastcgi_params;
    }
    But both @php locations doesn't work....

    I think Centminmod includes the related settings and there is a conflict....

    Can you please help me on that?

    Last step before my friend join Centminmod :)

    Thank you
     
    Last edited: Jan 21, 2019
  2. pamamolf

    pamamolf Premium Member Premium Member

    3,806
    369
    83
    May 31, 2014
    Ratings:
    +711
    Local Time:
    2:14 AM
    Nginx-1.17.x
    MariaDB 10.3.x
    I just fix that by adding the php rules on top of the Amember rules :)
     
  3. redbot

    redbot Dreaming of Debmin Mod Premium Member

    33
    6
    8
    Mar 30, 2020
    Ratings:
    +15
    Local Time:
    6:14 PM
    The issue with amember's default rules is that they overwrite all the php handling of centminmod's php.conf
    https://docs.amember.com/docs/Installation/Nginx

    Here's my fix:

    find
    Code:
    location ~ \.php$ {
    replace
    Code:
    location ~ ^\/amember\/.*\.php$ {
    and now it will only affect amember, and the rest of your site can enjoy the optimized php.conf
     
  4. eva2000

    eva2000 Administrator Staff Member

    44,412
    10,141
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,689
    Local Time:
    9:14 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    thanks @redbot for sharing your insights (y)