Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have changed my Document Root in the MAMP settings to a folder in my Dropbox so I can easily sync my files between computers. This was fine until I started to using relative file paths, the URL was not found because it was looking in the root rather than the subdirectory that held the site files.

I've tried to set up a virtual host to solve the problem, but it seems that having set my own MAMP document root to Dropbox is not letting this happen. I added this line to the bottom of my hosts file 127.0.0.1 oip.local and I have this at the end of my Apache httd.conf:

NameVirtualHost *

<VirtualHost *:80>    
    DocumentRoot "/Volumes/OSX/Lara/Dropbox/Sites"    
    ServerName localhost 
</VirtualHost> 

<VirtualHost *:80>    
    DocumentRoot "/Volumes/OSX/Lara/Dropbox/Sites/onlyinpgh"    
    ServerName oip.local 
</VirtualHost>

If I go to settings and change the document root back to /Applications/MAMP/htdocs, the oip.local gets to the proper home page, but (as expected) everything breaks as soon as I point to a file in the root because it's in Dropbox, not htdocs. I've been restarting MAMP, clearing Cache/Cookies, restarting browsers throughout the process. I also have the Apache port set the the default, 80.

Any idea how to avoid this? Is there a better way than Dropbox to sync my site files across computers? Thanks in advance.

share|improve this question

1 Answer 1

The argument must be the same as the NameVirtualHost argument, i.e. you need to use:

NameVirtualHost *:80

Also, you could consider using Selective Sync to choose the folder you want to sync with the Dropbox app.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.