web:codding:php:virtual-host
Comment ajouter un hôte virtuel dans APACHE2
Partons du principe que votre site est déjà en place:
Je copie le fichier de conf et l'adapte à mes besoins.
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/monsite.com.conf sudo nano /etc/apache2/sites-available/monsite.com.conf
Modification du fichier de conf:
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html/public_html
<Directory /var/www/html/public_html>
Options -Indexes
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Une fois adapté utiliser la commande a2ensite de PHP pour ajouter votre conf dans Apache:
sudo a2ensite monsite.com.conf sudo service apache2 restart
Apres cela tout devrait être fonctionnel.
Attention sous raspbian Buster le répertoire par default est bien /var/www/html
— sylvain 2019/10/17 21:19
web/codding/php/virtual-host.txt · Dernière modification : de 127.0.0.1
