Forum

Thread tagged as: Problem

404 at login with Runway + MAMP (running NGINX)

I'm trying to get my local setup working with NGINX inside MAMP and have managed to get it running ok. The problem comes when I try to log into the CMS via the /perch/ subdirectory: it's returning a 404. I'm assuming this is something to do with the rewrite rules, but I'm using the rules outlined here so I guess it should work:

location = / {
    try_files $uri @runway;
}

location / {
    try_files $uri $uri/ @runway;
}

location @runway {
    rewrite ^ /perch/core/runway/start.php last;
}

Do you have any idea what could be going wrong?

Martin Underhill

Martin Underhill 5 points

  • 3 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

We can't advise on local development setups I'm afraid. I'd suggest asking the support for MAMP if you are having MAMP issues.

Thanks Rachel – totally understand :)

In case anyone else is trying to do the same, I've got it running:

  • Open MAMP and go to Ports and click the switch arrows icon so that you're running Nginx on port 80 (you'll have to switch these back when you want to dev on an Apache site – I couldn't work out how to get Nginx running on port 81)
  • Go to the site you want to run on Nginx in your Hosts and change it to Nginx in the 'Use with' radio buttons
  • Head to the Nginx tab in your selected host
  • Add $uri $uri/ @runway; to the 'try_files' input near the top in the 'Additional parameters for location /' section
  • Add the rest of the rules to the 'Additional parameters for <server> directive' textarea at the bottom:
  • Save your changes so that it restarts Nginx and MySQL (I changed my GroupStart to only have these two running, removing Apache; again, I'll change it back when I start work on an Apache site again)
location = / {
    try_files $uri @runway;
}

location @runway {
    rewrite ^ /perch/core/runway/start.php last;
}

Next challenge: get it working over SSL…