Sécuriser vos Vhosts

Uniquement les requêtes GET HEAD et POST sont autorisé if ($request_method !~ ^(GET|HEAD|POST)$ ) { return 444; } Pour ne pas loger les accès aux fichiers favicon.ico et robots.txt location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } L’accès aux fichiers caché peuvent être dangereux tel qu’un .bash_history contant un mot de passe tapé par erreur ou un .my.cnf avec un compte MySQL, l’accès a tous les fichiers caché est donc interdit : [Lire]

Dynamique Vhost

Exemple de configuration du module Apache mod_vhost_alias :

Options FollowSymLinks
AllowOverride all
Allow from all
UseCanonicalName Off

LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/log/apache2/access.vhosts.log vcommon

VirtualDocumentRoot /var/www/%0/www
VirtualScriptAlias /var/www/%0/cgi-bin

Documentation : http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html