# Le nom du sous-domaine est mis dans une variable sub, # utilisée ensuite pour définir la racine # Sites dokuwiki server { listen 80; server_name ~^(?Pdoc|perso|site2)\.chateau\.parc$; root /var/www/html/$sub; location / { index index.php index.html index.htm; try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; } location ~ /(data|conf|bin|inc)/ { deny all; } location ~ /\.ht { deny all; } } # Autres sous-domaines server { listen 80; server_name ~^(?P.+)\.chateau\.parc$; root /var/www/html/$sub; location / { index index.php index.html index.htm index.nginx-debian.html; try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; } location ~ /\.ht { deny all; } }