I am posting this because I recently had a lot of trouble setting up a Virtual Host with a MAMP stack, due to Apple's throttling of the useable PHP version on Mac OS 10.8's default Apache2 installation.
This is a very quick guide on what to do and I owe the solution to this question on Stack Overflow:
You can think of this as a compilation of what worked for me, as the accepted answers had no effect, but rather those with a significantly lower score.
Similarly, every guide I have seen fails to mention some points which users answered with on the sourced question.
Although the above answer is much explanatory, the following 2 things are most important when you are migrating virtual hosts to apache 2.4
Go to
wamp/bin/apache/apache2.4.x/conf/httpd.conf
find#Include conf/extra/httpd-vhosts.conf
and uncomment toInclude conf/extra/httpd-vhosts.conf
Add the virtual hosts in
wamp/bin/apache/apache2.4.x/conf/extra/httpd-vhosts.conf
asNote:
<Directory **/**>
the / is importantStep 1: Install and configure Apache.
Make sure you specify what port you want to listen on, for me I specified
8080
. This will be the case for this series of instructions.Listen 8080
- Default is 80Step 2: Edit your
/etc/hosts
file to spoof your loopback address, 127.0.0.1You should really add a handle for subdomains on your web server, Apache or Nginx (or whatever else you use. Something that routes www to non-www.
Step 3: Enable the Virtual Hosts import on Apache.
httpd.conf
file located within Apache2's subdirectories. Usually within/conf
Include conf/extra/httpd-vhosts.conf
LoadModule log_config_module modules/mod_log_config.so
Step 4: Configure your Virtual Hosts file
httpd-vhosts.conf
, you can comment out the two example Virtual Hosts in the file. Usually within/conf/extra
You're Done!
Once your Virtual Host has been edited to your liking you are done, just restart Apache and enjoy.
This guide already includes the fixes implemented, but in-case you still get permission errors:
DocumentRoot
is not inside any documents your user explicitly owns. If it needs to be, give"Read Only"
access to "Everyone" on Mac for that particular folder, E.g. "Documents" or "Movies" etc....