Web & data

Create a virtual host

nano /etc/apache2/sites-available/mon-site.conf<VirtualHost *:80> DocumentRoot "/var/www/mon-site" ServerName mon-site.com ServerAlias www.mon-site.com ErrorLog ${APACHE_LOG_DIR}/mon-site.error CustomLog ${APACHE_LOG_DIR}/mon-site.access combined <Directory /var/www/mon-site> Require all granted Options FollowSym

· 1 min read · level: intermediate

nano /etc/apache2/sites-available/mon-site.conf

<VirtualHost *:80>

DocumentRoot "/var/www/mon-site"

ServerName mon-site.com

ServerAlias www.mon-site.com

ErrorLog ${APACHE_LOG_DIR}/mon-site.error

CustomLog ${APACHE_LOG_DIR}/mon-site.access combined

<Directory /var/www/mon-site>

Require all granted

Options FollowSymlinks MultiViews

AllowOverride All

<IfModule mod_dav.c>

Dav off

</IfModule>

SetEnv HOME /var/www/mon-site

SetEnv HTTP_HOME /var/www/mon-site

Satisfy Any

</Directory>

</VirtualHost>

Replace mon-site with the name of your site

a2ensite mon-site

To secure it with HTTPS:

certbot --apache

More to come (this part is for a student)

Illustration 1 — Créer un virtualhost