okonjin
okonjin

Reputation: 151

MAMP - Virtual Hosts not working

I'm having trouble getting Virtual Hosts to work on MAMP.

Here's my hosts file:

127.0.0.1 localhost
127.0.0.1 mysite

Here's my httpd-vhosts.conf file:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80



#
# Custom Virtual Hosts
#
<VirtualHost *:80>
    DocumentRoot "/Users/(username)/Documents/"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/Users/(username)/Documents/foo/bar/"
    ServerName mysite
    <Directory "/Users/(username)/Documents/foo/bar/">
        AllowOverride all
    </Directory>
</VirtualHost>

My httpd.conf looks like this:

# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

http://mysite doesn't work. I restarted the apache servers multiple times. I've taken a look into multiple threads on this subject on here, but I can't figure out what's wrong.

EDIT: btw, I'm using /Users/(username)/Documents as my document root for MAMP, maybe I should replace those with the usual /Applications/MAMP/htdocs anyway ?

Upvotes: 1

Views: 2611

Answers (1)

Aliu
Aliu

Reputation: 36

Check that the ports you set for apache is what you set in your httpd-vhosts.conf file. If its port 80. it should be same in your Mamp apache port.

Upvotes: 1

Related Questions