Friday, September 23, 2016

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:\Dev\Sites\FolderOfSite"
    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:\windows\system32\drivers\etc)


...
127.0.0.1 site.localhost.com