Download Xampp for Mac Os X 10.5.8
A while back I posted virtually configuring virtual hosts in MAMP. More recently I noticed that MAMP hadn't been updated in about a year and their back up forum resembled a wilderness. Thinking that maybe the writing was on the wall for MAMP I started looking for an culling and came beyond XAMPP.
XAMPP provides a similar local server environment to MAMP, but configuring virtual hosts is a picayune different. Unlike the Pro version of MAMP , XAMPP doesn't accept a overnice GUI to permit virtual hosts to be configured easily. So, there is no culling but to do it manually.
With XAMPP we demand to edit 3 files as opposed to only the two with MAMP. These are /etc/hosts, /Applications/XAMPP/xamppfiles/etc/httpd.conf and /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf. I'thou assuming that you've not already added virtual hosts to the /etc/hosts file for a previous MAMP install.
Update: A new version of MAMP (one.8) was released in September 2009.
ane. What You'll Demand
The /etc/hosts file is hidden and a standard or admin user doesn't normally have write access to information technology. To edit this file you lot can open TextEdit with root privileges from a Terminal window like and so.
sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts
An alternative is to use an editor like Smultron which has an selection from the File carte to Open Hidden.. files and will inquire for authentication if required. Smultron is free and whilst no longer nether development works under x.5.eight.
2. Example
In the example I'm going to configure a virtual host for a site that has a root folder of /Users/steve/Sites/MySite1/ and I'll name the virtual host local.mysite1.
Ensure you terminate XAMPP's Apache server earlier editing either of the files below.
3. Editing the hosts File
Open up the /etc/hosts file. Yous should run across something like this:
# /etc/hosts ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not alter this entry. ## 127.0.0.one localhost 255.255.255.255 broadcasthost ::i localhost fe80::one%lo0 localhost
We demand to add a line to the end of this file for each virtual host we desire to configure. The comment line is optional.
# Virtual Hosts 127.0.0.ane local.mysite1
The file should now resemble this.
# /etc/hosts ## # Host Database # # localhost is used to configure the loopback interface # when the organisation is booting. Do non change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::ane localhost fe80::1%lo0 localhost # Virtual Hosts 127.0.0.1 local.mysite1
Save and close the file.
4. Editing XAMPP's httpd.conf File
Open up/Applications/XAMPP/xamppfiles/etc/httpd.conf. On or around line 487 you should come across this.
# Virtual hosts # Include etc/extra/httpd-vhosts.conf
Nosotros need to un-comment line 488 like so.
# Virtual hosts Include etc/extra/httpd-vhosts.conf
Save and shut the file.
5. Editing XAMPP's httpd-vhosts.conf File
Virtual hosts in XAMPP are configured in the httpd-vhosts.conf file and non the usual httpd.conf file. Then, open the file /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf. Y'all should see this.
# # VirtualHost case: # About any Apache directive may get into a VirtualHost container. # The showtime VirtualHost department is used for all requests that practice non # match a ServerName or ServerAlias in any <VirtualHost> cake. # <VirtualHost *:80> ServerAdmin [e-mail protected] DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host.case.com" ServerName dummy-host.example.com ServerAlias www.dummy-host.example.com ErrorLog "logs/dummy-host.example.com-error_log" CustomLog "logs/dummy-host.example.com-access_log" common </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host2.example.com" ServerName dummy-host2.example.com ErrorLog "logs/dummy-host2.example.com-error_log" CustomLog "logs/dummy-host2.example.com-access_log" mutual </VirtualHost>
Remove the example virtual host configurations first on line 23 then add the following code cake at the stop of the file.
Note that although I only want to configure a virtual host for local.mysite1, outset on line 24 I've added a virtual host for localhost as the default named sever with the ServerName set to localhost and the DocumentRoot and <Directory> set to /Applications/XAMPP/htdocs. If y'all don't, when you point your browser to http://localhost all you'll see is the directory listing of the first virtual host, in this case local.mysite1, and not the XAMPP kickoff page. You do non need to add a respective entry in /etc/hosts equally this is included past default.
For the local.mysite1 configuration y'all can see that first on line 37 we are setting the ServerName to the name of virtual host nosotros configured in the /etc/hosts file. The DocumentRoot and <Directory> are set to the site's root folder.
# # VirtualHost case: # Most any Apache directive may go into a VirtualHost container. # The beginning VirtualHost department is used for all requests that practise not # match a ServerName or ServerAlias in any <VirtualHost> block. # # localhost [must be included as the default named server] <VirtualHost *:80> ServerName localhost DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" <Directory "/Applications/XAMPP/xamppfiles/htdocs"> Options Indexes FollowSymLinks Includes execCGI AllowOverride None Require all granted </Directory> </VirtualHost> # mysite1.com <VirtualHost *:fourscore> ServerName local.mysite1 DocumentRoot "/Users/steve/Sites/MySite1" <Directory "/Users/steve/Sites/MySite1"> Options Indexes FollowSymLinks Includes execCGI AllowOverride None Require all granted </Directory> </VirtualHost>
Save and close the file.
6. Testing the Virtual Host
To ensure the virtual host has been configured correctly, restart XAMPP's Apache server and bespeak your browser to http://local.mysite1
I would recommend backing-up the /etc/hosts, /Applications/XAMPP/xamppfiles/etc/httpd.conf and /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf files whenever you brand changes and store them on a split up drive or USB stick. If you later re-install the Os or XAMPP you'll lose the changes to the respective files. This manner y'all tin can easily restore your virtual host configuration.
Download Xampp for Mac Os X 10.5.8
Posted by: richardshispout.blogspot.com

0 Komentar
Post a Comment