Skip to content

Hosts and virtual hosts

Peter Ajtai edited this page Sep 25, 2012 · 38 revisions

Setting up a virtual host through XAMPP

  • Hosts file in Windows XP Pro & Windows 7

    • C:\windows\system32\drivers\etc\hosts
  • Virtual hosts file in Apache in XAMPP

    • C:\xampp\apache\conf\extra\httpd-vhosts.conf
  • Hosts file in Mac

    • /private/etc/hosts
  • Apache config file in Mac

    • /private/etc/apache2/httpd.conf
  • Uncomment the Virtual Hosts line

Include /private/etc/apache2/extra/httpd-vhosts.conf
  • Apache virtual hosts file in Mac
    • /private/etc/apache2/extra/httpd-vhosts.conf

Ubuntu

Some tips

Hosts file /etc/hosts

turn on virtual hosts in /etc/apache2/apache2.conf

NameVirtualHost *:80

now create individual sites for storage in: /etc/apache2/sites-available/...

activate them in: /etc/apache2/sites-enabled/

If you get the error:

client denied by server configuration:

Make sure to include a "Directory" entry:

<VirtualHost *:80>
    ServerAdmin bob@bobertson.com
    DocumentRoot "/Users/bob/rad-app"
    ServerName paperwoven
    ErrorLog "/private/var/log/apache2/rad-app.error.log"
    CustomLog "/private/var/log/apache2/rad-app.access.log" common
    <Directory "/Users/bob/rad-app">
		Options -Indexes FollowSymLinks
		AllowOverride AuthConfig FileInfo
		Order allow,deny
		Allow from all
	</Directory>		
</VirtualHost

Linked from:

Apache on Mac
Apache
Windows

Total of 183 pages.
Total of 67 pages not in main tree.
Total of 147 nodes.
This Sidebar and the "Linked From" sections created by Wiki Buddy
The full tree is at _WB-Full-Tree

Clone this wiki locally