The Developer Day | Staying Curious

Apr/09

21

Adding a virtual host on apache windows xampp

Setting up virtual host on windows using apache and possibly XAMPP is easy but may cause some trouble to the inexperienced. To setup a virtual host follow these steps:

1. Locate your vhosts file. On my PC it’s: D:\apache\conf\extra\httpd-vhosts.conf
2. Uncomment the following line: NameVirtualHost *:80
3. Add your virtual host definition:


     DocumentRoot "D:\www\myproject\"
     ServerName myproject.com
     
          Allow from all
          Options +Includes +Indexes +FollowSymLinks
          AllowOverride all
     

4. Open a file name hosts located at: C:\WINDOWS\system32\drivers\etc
5. Add the following line: 127.0.0.1 myproject.com
Check that for project path correct slashes are being used. Apache seems to not understand \ slashes and instead wants /. If you try and start apache from a command line it may output something like this:

Syntax error on line 45 of D:/XamppLite/apache/conf/extra/httpd-vhosts.conf:
DocumentRoot must be a directory

RSS Feed

No comments yet.

Leave a comment!

<<

>>

Find it!

Theme Design by devolux.org