Welcome to Centmin Mod Community
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

    4,067
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    2:15 PM
    Nginx-1.25.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

    4,067
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    2:15 PM
    Nginx-1.25.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

    51
    10
    8
    Mar 30, 2020
    Ratings:
    +25
    Local Time:
    6:15 AM
    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

    52,654
    12,070
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,596
    Local Time:
    9:15 PM
    Nginx 1.25.x
    MariaDB 10.x
    thanks @redbot for sharing your insights (y)