Skip to content

Instantly share code, notes, and snippets.

@jfloff
Last active May 18, 2019 10:12
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfloff/4750950 to your computer and use it in GitHub Desktop.
Save jfloff/4750950 to your computer and use it in GitHub Desktop.
Virtual Hosts for MAMP
  1. Open hosts file:

    $ sudo subl /private/etc/hosts
    
  2. Place the following line at the end of the file:

    127.0.0.1 link
    
  3. Open MAMP's vhosts file:

    subl /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
    
  4. Change NameVirtualHost*:80 settings to NameVirtualHost *:8888. And add at the end of the file (you can delete the placeholders one):

    <VirtualHost *:8888>
    		ServerName link
    		DocumentRoot path_to_public_dir
    		SetEnv APPLICATION_ENV "development"
    		<Directory path_to_public_dir>
        		DirectoryIndex index.php
        		AllowOverride All
        		Order allow,deny
        		Allow from all
    		</Directory>
    </VirtualHost>
    
  5. Restart MAMP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment