Creating virtualhost on MAMP is very easy. Suppose you want to make a virtualhost named
1 | local.myweb.com |
. Just follow the steps below…
- Open your hosts file located in
1/etc/hosts
. To open a file either you can use your favorite text editor or use nano in command line.
1sudo nano /etc/hosts. Now add the following line
1127.0.0.1 local.myweb.com(Save and exit. If you are using nano then press ctrl+x, press y then press enter).
- Create a file named
1vhosts.conf
in
1/Applications/MAMP/conf/apache/vhosts.confand then open it.
- Copy and paste following lines in it.
1
2
3
4
5
6
7
8
9
10
11
12<VirtualHost *:80>
ServerName local.myweb.com
ServerAlias local.myweb.com
DocumentRoot /Applications/MAMP/htdocs/myweb
ErrorLog /Applications/MAMP/logs/myweb.log.txt
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /Applications/MAMP/htdocs/myweb/>
Options -Indexes +IncludesNOEXEC +FollowSymLinks
allow from all
AllowOverride All
</Directory>
</VirtualHost> - Enable your virtualhost by adding below line in
1/Applications/MAMP/conf/apache/httpd.conf
at the bottom of the file.
1
2NameVirtualHost *:80
Include /Applications/MAMP/conf/apache/vhosts.conf - Restart your apache server and test it. Open your web browser and type local.myweb.com you will see

Tada you are done! Enjoy and correct me if I’m wrong
Related posts:
- How to change root password on MAMP
- Creating virtual host in ubuntu.
- Get started with Zend Framework.
2 Responses to “Create VirtualHost in your MAMP.”
Trackbacks/Pingbacks
- Get started with Zend Framework. | My Planet - [...] root by creating a virtual host. If you don’t know how to create it please follow this post. 1234567891011<VirtualHost ...








Nice blog, keep it up
Thanks