Discover Centmin Mod today
Register Now

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 Well-Known Member

    4,101
    428
    83
    May 31, 2014
    Ratings:
    +838
    Local Time:
    12:30 AM
    Nginx-1.26.x
    MariaDB 10.6.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 Well-Known Member

    4,101
    428
    83
    May 31, 2014
    Ratings:
    +838
    Local Time:
    12:30 AM
    Nginx-1.26.x
    MariaDB 10.6.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:
    4:30 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

    55,424
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,839
    Local Time:
    7:30 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    thanks @redbot for sharing your insights (y)