Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Jimmy Maurice
Jimmy Maurice
9,379 Points

How to set up a Virtual host With MAMP on Yosemite ?

Hi everyone !

I'm trying to set up a virtual host to create a web application development environment on my computer. I need to do this because of $_SERVER['DOCUMENT_ROOT'] issues.

My OS is Yosemite and i have already installed MAMP. I've already read many tutorials on the internet, but the tips don't seem to work with my Apache configuration. I add a line in my hosts file :

/etc/hosts

I added the last line : 127.0.0.1 monsite.dev

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##

255.255.255.255 broadcasthost

#localhost
::1         localhost 
127.0.0.1   localhost 
127.0.0.1   monsite.dev

then i made some modifications in my httpd.conf

/Applications/MAMP/conf/apache/httpd.conf

I put this :

NameVirtualHost *
<VirtualHost *:8888>
    DocumentRoot "/Applications/MAMP/htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:8888>
    DocumentRoot "/User/me/Sites/mysite"
    ServerName mysite.dev
</VirtualHost>

I miss something but i don't know what.

Does anybody know any good tutorial or tricks ? Thanks !