My recommend virtual host configuration would look like this:
- Code: Select all
# blank default vhost - only used for debug reasons
<VirtualHost _default_:80>
DocumentRoot "C:/xampp/vhosts/honeypot"
ErrorLog "logs/honeypot-error.log"
CustomLog "logs/honeypot-access.log" common
<VirtualHost *:80>
# localhost vhost
<VirtualHost *:80>
Servername localhost
DocumentRoot "C:/xampp/htdocs"
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
# foo.dev vhost
<VirtualHost *:80>
Servername foo.dev
DocumentRoot "C:/xampp/vhosts/foo.dev/htdocs"
ErrorLog "logs/foo.dev-error.log"
CustomLog "logs/foo.dev-access.log" common
<Directory "C:/xampp/vhosts/foo.dev/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
# bar.dev vhost
<VirtualHost *:80>
Servername bar.dev
DocumentRoot "C:/xampp/vhosts/bar.dev/htdocs"
ErrorLog "logs/bar.dev-error.log"
CustomLog "logs/bar.dev-access.log" common
<Directory "C:/xampp/vhosts/bar.dev/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Explaination:
- Create a default vhosts to not get confused in cause of not matching vhosts (otherwise the very first vhosts would take effect)
- if you still want to use the XAMPP Dashboard create a localhost vhost
- Each used vhost gets its own log files
- Each used vhost gets its own Access Rules (i know that there is already an Access Rule defined for the localhost vhost, but having it all in the vhost config is cleaner in my opinion)
- I never configure any vhost in a subfolder of another vhost (this can have sideeffects with webapplications if the wrong URL is used accidentically)
- I place the DocumentRoot folder for each vhost one folder deeper than needed at minimum to keep the possibility to cleanly place files above the DocumentRoot
I would like to have an active discussion about my recommantdation with the experts here so i can write a sticky for this topic
@gsmith: Thanks for telling me about Define. I will take a look at this. Could be very powerful