Using a symlink as the document root in MAMP hosts
Asked Answered
R

0

7

I'm using MAMP PRO v3.0.7.2

I want to specify a symlink as the document root for a specific entry in MAMP Pro's host section which points to the latest build of my project, which can change many times a day during development. The problem is when I select this symlink as my document root, MAMP rewrites the path to match whichever directory to symlink is pointing to.

The build script for my project updates that symlink to point to the latest release directory on every rebuild, but MAMP still has that previous release as the document root.

So for example I want the document root to be:

/Users/username/Sites/projectname/live

which is a symlink that currently points to a directory:

/Users/username/Sites/projectname/releases/2014-10-24-17_25_52

MAMP does not respect the symlink path, but instead rewrites it to

/Users/username/Sites/projectname/releases/2014-10-24-17_25_52

So when I rebuild my project later, MAMP is still pointing the document root to the path above, but /live is now pointing to

/Users/username/Sites/projectname/releases/2014-10-24-18_17_48

In the past I have configured Apache manually and it was fine with using the symlink as the document root, and whenever I rebuilt the project the most current build resolved at the URL defined in vhosts without having to edit anything or restart Apache.

I tried manually editing the respective VirtualHost entry MAMP's httpd.conf file in Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf, but whenever the server is restarted it overwrites my changes and rewrites all instances of the path back to whatever directory the /live symlink is currently pointing to.

Is there a way around this so that I can specify a symlink as the document root, and have it always point to that symlink rather than the actual directory that is currently being symlinked to? Otherwise I have to manually change it and restart servers many extra times a day, which gets old pretty fast.

Romeu answered 24/10, 2014 at 20:2 Comment(4)
What happens when you make Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf read only after modifying it? The server shouldn't be able to overwrite it after a restart i guess.Ocher
This is still happening in Mamp Pro 3.5. I've contacted support and will hopefully have an answer soon.Educator
Are there any news on this? @EducatorInsanitary
@Simon Unfortunately no. Haven't received an email back. I'll post here if they update me.Educator

© 2022 - 2024 — McMap. All rights reserved.