Sample Apache Virtual Host in Windows with XAMPP

Reference to self:

1. Activate vhosts in XAMPP by going to http.conf and check if

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

is present (if commented out, uncomment it)

2. Set up http-vhosts.conf (usually inside “extra” folder) with below sample (change server admin, name and directories to the appropriate values)

NameVirtualHost *:80

<virtualhost>
    ServerAdmin admin@server.com
    DocumentRoot “D:DevSitesFolderOfSite”
    ServerName site.localhost.com
    ErrorLog “logs/site-localhost-com-error.log”
    CustomLog “logs/site-localhost-com-access.log” common
 <directory ev=”” ites=”” olderofsite=”” public=””>
  Options Indexes FollowSymLinks Includes ExecCGI
  AllowOverride All
  Require all granted
 </directory>
</virtualhost>

3. Change hosts file in Windows (usually c:windowssystem32driversetc)


127.0.0.1 site.localhost.com

Leave a Reply

Your email address will not be published. Required fields are marked *