How to set up hosts file for local environment?
- by n00b0101
I'm trying to create subdomains on my localhost and am way out of my territory... I'm running MAMP on my Mac OS X and I thought/think I had/have to do the following:
(Assuming I want to create me.localhost.com and you.localhost.com)
(1) Edit /private/etc/hosts
Right now, it looks like this:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
So, do I just make it:
127.0.0.1 localhost
127.0.0.1 me.localhost.com
127.0.0.1 you.localhost.com
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
(2) I'm assuming I don't need to mess with DNS at all because it's local? So, the hosts file should suffice?
(3) And then, I need to edit my httpd.conf file to include virtual hosts? I tried this, but it's not picking it up...
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs/me.localhost.com"
ServerName me.localhost.com
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs/you.localhost.com"
ServerName you.localhost.com
</VirtualHost>
Not sure if I'm way off-base here... Help is greatly appreciated!