leemarquis
01-21-2009, 10:47 PM
Can someone help me set up virtual hosts with MAMP on OSX10.4? I cant get it to work properly...
In MAMP I have:
APACHE PORT: 80
MYSQL PORT: 3306
and Document Root is:
/Users/Lee/Sites
My hosts file is:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost beautybytara.local
255.255.255.255 broadcasthost
::1 localhost
My httpd.conf file ends with:
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *
<VirtualHost *>
DocumentRoot /Users/Lee/Sites
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot /Users/Lee/Sites/beautybytara
ServerName beautybytara.local
</VirtualHost>
In my Sites folder I have a folder named beautybytara in which all the site files exist.
After restarting MAMP and pointing my browser to : http://beautybytara.local
I just get the Test page for apache Installation page - even though there is an index file in the folder. If I type http://beautybytara.local/index.html I still get the same page.
If I go to http://localhost then I get a test index page load up that I placed in the Sites directory.
If I go to http://localhost/beautybytara then site load as expected but because the document root is at the Sites folder and not the beautybytara folder the PHP code does work as it uses document root in the code to find includes etc.
What am I doing wrong? I want each folder in the Sites directory to act as its own document root.
Thanks
In MAMP I have:
APACHE PORT: 80
MYSQL PORT: 3306
and Document Root is:
/Users/Lee/Sites
My hosts file is:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost beautybytara.local
255.255.255.255 broadcasthost
::1 localhost
My httpd.conf file ends with:
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *
<VirtualHost *>
DocumentRoot /Users/Lee/Sites
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot /Users/Lee/Sites/beautybytara
ServerName beautybytara.local
</VirtualHost>
In my Sites folder I have a folder named beautybytara in which all the site files exist.
After restarting MAMP and pointing my browser to : http://beautybytara.local
I just get the Test page for apache Installation page - even though there is an index file in the folder. If I type http://beautybytara.local/index.html I still get the same page.
If I go to http://localhost then I get a test index page load up that I placed in the Sites directory.
If I go to http://localhost/beautybytara then site load as expected but because the document root is at the Sites folder and not the beautybytara folder the PHP code does work as it uses document root in the code to find includes etc.
What am I doing wrong? I want each folder in the Sites directory to act as its own document root.
Thanks