I ran into some trouble running through different tutorials to setup virtual hosts while setting up a local Laravel site. There doesn’t seem to be much consensus on the developers’ preferred local environment. So here’s how to
Allow Virtual Hosts
In finder, go to Applications > MAMP > conf > apache > httpd.conf and open the file with a text editor.
Find this line:
Uncomment the second line.
Allow SymLink Override
In the same file find:
<Drectory /> Options Indexes FollowSymLinks AllowOverride None </Directory>
Change None to All
Add the Virtual Host Path
Ensure the document root is Applications > MAMP >
In the extra/
<VirtualHost *:80> ServerName example.test DocumentRoot "/path/to/directory" </VirtualHost>
Allow Your Computer to Recognize Your Local Domain
In the terminal write:
Pico is a terminal text editor. We’ll add the new server name “example.test” after the last 127.0.0.1.
8888 from custom server URL Remove :
Listen 8888 ServerName localhost:8888
Replace 8888 with 80 and save the file.
In MAMP Preferences > Ports, change the Apache Port to 80, Nginx Port to 8888, and MySQL Port to 3306. Your settings might already have this.
Once you restart the server the