Hi from Paris!
Mamp seems to be a great application : thanxs Holger !!!
I'm triying to deal with virtualhosting.
After reading all the topics from this forum relative to the subject, I started my experimentations :
First, I started by create two folders in the htdocs folder, named "sitea" end "siteb".
In this each of these folders, I placed a file named "index.php" contening this little piece off code :
- Code: Select all
<?
echo("hello world !");
?>
After that, I open the httpd.conf file which path is : /Applications/MAMP/conf/httpd.conf
Then I putted those line in it :
- Code: Select all
### 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 example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs/sitea"
ServerName localhosta
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs/siteb"
ServerName localhostb
</VirtualHost>
Then I open the terminal, open pico and started to edit the following file : /etc/hosts
I putted those lines :
- Code: Select all
##
# 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 localhosta localhostb
255.255.255.255 broadcasthost
::1 localhost
Then I open Mamp.
I typed this url :
http://localhosta/ (my default port is 80)
Then : Miracle, "hello world" appears on my screen !!
I repeated the experience with
htttp://localhostb/, then: "hello world" again !!!
I'm very happy I've managed to make two virtualhosts !!
My next step is to manage to have this two folders on another volume.
So I copy and paste my two folders in a new location :
/Volumes/Données/sitea and
/Volumes/Données/siteb
I open again my httpd.conf file and put those line in it :
- Code: Select all
### 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 example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Volumes/Données/sitea"
ServerName localhosta
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Volumes/Données/siteb"
ServerName localhostb
</VirtualHost>
I reboot my servers and then try again :
http://localhosta/
Then, no "hello world" but error 403 :
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.0.50 (Unix) PHP/4.3.11-dev Server at localhosta Port 80
Where is the problem and where is the solution ?
Antoine
PS : I'm a newbie in the mac world, so sorry if the answer seems to be little bit evident for you
PPS : Sorry for my bad english, hope it will be understood.