Learn about Centmin Mod LEMP Stack today
Become a Member

Nginx rewrite rule doesn't work at Centminmod but it works on Nginx old server

Discussion in 'Forum software usage' started by pamamolf, Jan 17, 2019.

  1. pamamolf

    pamamolf Premium Member Premium Member

    4,070
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    6:56 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Hello

    I have a weird problem helping a friend of me to move to Centminmod.

    My friend has on old server (Nginx default installation) and his IPB forum (v3) is at the forum path like this:

    and the forum link is:

    The index main page work with no issues on the new server.

    When you click on forum category or browse for a topic the link turn to:

    I don't like that double forum in the link but as he want it as it is i will try to do it...

    So on that link i am getting a 503 error.

    If i remove manually from the link one of both /forum/ it works so the problem should be the redirect rule....

    I did check and got at the old Nginx config the related rule:

    Code:
            location /forum/ {
                    index index.php;
                    try_files $uri $uri/ /forum/index.php?q=$request_uri;
            }
    So i add it on Centminmod https config file and restart Nginx and i thought that this should work but no..

    It is very crazy as it works on the default Nginx config and not on Centminmod...

    Any ideas?

    I attach also the old config here....

    Thank you

     

    Attached Files:

    Last edited: Jan 17, 2019
  2. Jimmy

    Jimmy Well-Known Member

    1,778
    388
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +987
    Local Time:
    11:56 AM
    Isn't v3 EOL / unsupported? Time to upgrade and moving is the perfect time to do it.

    Good luck!
     
  3. eva2000

    eva2000 Administrator Staff Member

    53,559
    12,135
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,678
    Local Time:
    1:56 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Full nginx domain.com.ssl.conf or domain.com.conf config file ?
     
  4. JoeDer

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    6:56 PM
    Nginx 1.21.x
    MariaDB 10.3.x
  5. pamamolf

    pamamolf Premium Member Premium Member

    4,070
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    6:56 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Check attachment please...

    It doesn't work :(
     

    Attached Files:

  6. eva2000

    eva2000 Administrator Staff Member

    53,559
    12,135
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,678
    Local Time:
    1:56 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    problem is your /forums location context is embedded with your web root location / context and not outside of it
    Code (Text):
    location /forums {
       try_files  $uri $uri/ /forums/index.php;                                         <---Doesn't work
    }
    

    so it's conflicting with wordpress try_files directive
     
  7. pamamolf

    pamamolf Premium Member Premium Member

    4,070
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    6:56 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    When i was read your reply i was 100% that this should fix the problem but not :(

    I place the rewrite rule above the include lines at the config ( i try also above the rewrite rule for main / ) and restart Nginx but it was not working again :(

    Same error ...

    I can provide you access if you want to check it....just let me know please...
     
    Last edited: Jan 17, 2019
  8. JoeDer

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    6:56 PM
    Nginx 1.21.x
    MariaDB 10.3.x
  9. pamamolf

    pamamolf Premium Member Premium Member

    4,070
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    6:56 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    It doesn't work :(

    I did a try to change it to:

    try_files $uri $uri/ /forum/$request_uri;

    just out of curiosity and now i can see from a 503 error a 500 error....
     
    Last edited: Jan 18, 2019
  10. pamamolf

    pamamolf Premium Member Premium Member

    4,070
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    6:56 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Problem fixed !

    For unknown reason the collation of tables was mixed with latin1 and utf8 in the process of backup/restore ...

    I convert them to utf8 and all are ok now :)

    Thanks and sorry for the trouble.
     
  11. eva2000

    eva2000 Administrator Staff Member

    53,559
    12,135
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,678
    Local Time:
    1:56 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    ah mixed table collations !