We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30497
    • 245 Posts
    I am using the standard install of MODX.

    I was running an earlier V2 install on Apache, and it was working fine.

    We then moved our server, and set up a new machine using nginx and php-fpm. As part of the new setup, I decided to upgrade MODX. I did this by:

    * Installing a completely new 2.1.3-pl install
    * After success, replacing the new (clean) 2.1.3 database with my existing database, and then running setup again in order to upgrade the DB tables.

    I confirmed that everything is working with FURLs OFF. The whole site appears to run well. I then turn on FURLs, and I notice two things:

    1. Every dynamic link ( [[~link]] ), link generated with getResources, and link generated with wayfinder simply shows href="" - the parser does not insert the alias into the HTML when FURLs is ON.

    This one seems to be a problem that is not related to rewriting in nginx.

    2. Even if I try to directly access an alias, it doesn't return the page either.

    Any ideas?
      • 3749
      • 24,544 Posts
      Make sure you have this in the <head> section of all your templates:

      <base href="[[++site_url]]" />


      If that's not it, double-check the .htaccess file (make sure it's not ht.access) and look especially at the rewrite base line.

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 30497
        • 245 Posts
        Hi Bob,

        Thanks for your answer. Unfortunately my problem is a bit deeper than this:

        1. Yes, I have a base tag.

        2. As I say, I have moved OFF apache and ON to nginx, so htaccess is not relevant.

        Here is the site (You MUST access it without www - if the access it with WWW, you will see the "original site", on apache, all working.):

        http://financetrails.com/

        You'll see, by viewing source or hovering over any links, that each and every href="" is empty. So, it is an issue in MODX itself, not with rewrite config at the server level. If I turn off FURLS, the hrefs are populated correctly, for example, index.php?p=6


        • I don't recommend doing the move and upgrade at the same time. Move the site, get it running, and then upgrade it OR upgrade it and then move it. I believe you forgot to move your files to the new site according to your documented steps. A blank install and an old database upgraded will not have the files you have installed into your existing deployment unless you manually moved them into the clean 2.1.3 install.
            • 30497
            • 245 Posts
            Well, yes, I can do that and the suggestion is sensible. But, there are no files to forget as far as I see - I have moved all my static resources, and I have re-installed all the plugins I use. What type of files could I forget, core modx files that came with the new install?
            • Had a look at your error log?

              Whenever I noticed friendly urls are not being generated it is cause of some URI issues, which could very well be caused by a different move/upgrade method than suggested. Luckily the error log usually notifies you of that though, by filling up a bit on every request.
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 30497
                • 245 Posts
                Hi Mark,

                No errors in the nginx error log.

                I have reinstalled the original working-gr8-on-apache application on the new machine, with no upgrade to MODX.

                The behaviour is now slightly different to how I described earlier, but the end result is that URL rewriting is not working. What I see:

                * everything works great with FURLs turned off in MODX.
                * If I turn FURLs on, the links are generated correctly in the HTML (eg, "/features/" instead of "index.php?whatever"), but those links do not resolve to the correct pages - they just return me the home page.

                Here is my nginx config:


                server
                {
                listen 80;
                server_name www.financetrails.com financetrails.com;
                root /path/to/www.financetrails.com;
                index index.php;

                location / {
                root /path/to/www.financetrails.com;
                index index.php index.html;

                # This is the important part - map any extension of
                # /blahblahblah that doesn't exist to index.php

                if (!-e $request_filename) {
                rewrite ^(.*)$ /index.php?q=$1 last;
                }
                }

                location ~ \.php(.*)$ {
                include fastcgi_params;
                fastcgi_pass backend;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

                }
                • I meant the MODX error log smiley Reports -> Error Log

                  I'm honestly not into server stuff much, and that server config means nothing to me, lol.

                  Looks like you got it from here right? http://rtfm.modx.com/display/revolution20/Nginx+Server+Config
                    Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                    Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                    • 30497
                    • 245 Posts
                    oh, ok, no related errors in the modx error log either....

                    Yes, I got the config from there.
                      • 16863
                      • 29 Posts
                      I'm not a server expert either, but if I were having this problem I'd do a clean install of 2.1.3 and build a quick test site to rule out something in your ported site causing a conflict.
                      Of course, this thread is 10 days old, so you may have already done this…