

- #HOW TO EDIT HOSTS FILE MAC OS X PRO#
- #HOW TO EDIT HOSTS FILE MAC OS X CODE#
- #HOW TO EDIT HOSTS FILE MAC OS X FREE#

Note that although I only want to configure a virtual host for local.mysite1, beginning 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 set to /Applications/XAMPP/htdocs.
#HOW TO EDIT HOSTS FILE MAC OS X CODE#
Remove the example virtual host configurations beginning on line 23 then add the following code block at the end of the file. ServerAlias ErrorLog "logs/-error_log"ĬustomLog "logs/-access_log" commonĭocumentRoot "/Applications/XAMPP/xamppfiles/docs/"ĮrrorLog "logs/-error_log"ĬustomLog "logs/-access_log" common # match a ServerName or ServerAlias in any block.ĭocumentRoot "/Applications/XAMPP/xamppfiles/docs/" # The first VirtualHost section is used for all requests that do not # Almost any Apache directive may go into a VirtualHost container. So, open the file /Applications/XAMPP/xamppfiles/etc/extra/nf. Virtual hosts in XAMPP are configured in the nf file and not the usual nf file. We need to add a line to the end of this file for each virtual host we want to configure. # localhost is used to configure the loopback interface You should see something like this: # /etc/hosts 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.Įnsure you stop XAMPP’s Apache server before editing either of the files below.
#HOW TO EDIT HOSTS FILE MAC OS X FREE#
Smultron is free and whilst no longer under development works under 10.5.8. files and will ask for authentication if required. To edit this file you can open TextEdit with root privileges from a Terminal window like so.Ĭode sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hostsĪn alternative is to use an editor like Smultron which has an option from the File menu to Open Hidden. The /etc/hosts file is hidden and a standard or admin user doesn’t normally have write access to it. Update: A new version of MAMP (1.8) was released in September 2009. I’m assuming that you’ve not already added virtual hosts to the /etc/hosts file for a previous MAMP install. These are /etc/hosts, /Applications/XAMPP/xamppfiles/etc/nf and /Applications/XAMPP/xamppfiles/etc/extra/nf. With XAMPP we need to edit 3 files as opposed to only the 2 with MAMP. So, there is no alternative but to do it manually.
#HOW TO EDIT HOSTS FILE MAC OS X PRO#
Unlike the Pro version of MAMP, XAMPP doesn’t have a nice GUI to allow virtual hosts to be configured easily. XAMPP provides a similar local server environment to MAMP, but configuring virtual hosts is a little different. Thinking that maybe the writing was on the wall for MAMP I started looking for an alternative and came across XAMPP.

More recently I noticed that MAMP hadn’t been updated in nearly a year and their support forum resembled a wilderness. A while back I posted about configuring virtual hosts in MAMP.
