{{tag>tutoriel}} ====== Fichier /etc/nginx/sites-available/localhost ====== # 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 monpc.localhost; #~ root /var/www/html/farmer; #~ 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/php8.1-fpm.sock; #~ } #~ location ~ /(data|conf|bin|inc)/ { #~ deny all; #~ } #~ location ~ /\.ht { #~ deny all; #~ } #~ } # Sites dokuwiki server { listen 80; server_name ~^(?Pdoc|perso|magie|kine)\.localhost$; 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/php8.1-fpm.sock; } location ~ /(data|conf|bin|inc)/ { deny all; } location ~ /\.ht { deny all; } } # Autres sous-domaines server { listen 80; server_name ~^(?P.+)\.localhost$; 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/php8.1-fpm.sock; } location ~ /\.ht { deny all; } }