Want to subscribe to topics you're interested in?
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 Well-Known Member

    4,028
    421
    83
    May 31, 2014
    Ratings:
    +817
    Local Time:
    9:27 PM
    Nginx-1.17.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,762
    381
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +968
    Local Time:
    2:27 PM
    1.17.x
    MariaDB 10.3.x
    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

    50,891
    11,791
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,246
    Local Time:
    5:27 AM
    Nginx 1.25.x
    MariaDB 10.x
    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:
    9:27 PM
    Nginx 1.21.x
    MariaDB 10.3.x
  5. pamamolf

    pamamolf Well-Known Member

    4,028
    421
    83
    May 31, 2014
    Ratings:
    +817
    Local Time:
    9:27 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Check attachment please...

    It doesn't work :(
     

    Attached Files:

  6. eva2000

    eva2000 Administrator Staff Member

    50,891
    11,791
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,246
    Local Time:
    5:27 AM
    Nginx 1.25.x
    MariaDB 10.x
    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 Well-Known Member

    4,028
    421
    83
    May 31, 2014
    Ratings:
    +817
    Local Time:
    9:27 PM
    Nginx-1.17.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:
    9:27 PM
    Nginx 1.21.x
    MariaDB 10.3.x
  9. pamamolf

    pamamolf Well-Known Member

    4,028
    421
    83
    May 31, 2014
    Ratings:
    +817
    Local Time:
    9:27 PM
    Nginx-1.17.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 Well-Known Member

    4,028
    421
    83
    May 31, 2014
    Ratings:
    +817
    Local Time:
    9:27 PM
    Nginx-1.17.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

    50,891
    11,791
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,246
    Local Time:
    5:27 AM
    Nginx 1.25.x
    MariaDB 10.x
    ah mixed table collations !