Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a914d70e1 | |||
| d67e6daa7d |
@@ -1,19 +1,53 @@
|
|||||||
# Vhost
|
# VirtualHost
|
||||||
|
|
||||||
Mettre en place le vhost _formation.opendoor.fr_ en respectant les conditions suivantes:
|
## Introduction
|
||||||
|
|
||||||
Fichier de configuration: /etc/apache2/sites-available/formation.opendoor.fr.conf
|
Mise en place du site _formation1.lia.fr_
|
||||||
|
|
||||||
Nom du serveur: formation.opendoor.fr
|
On s'assurera de l'association formation1.lia.fr <-> adresse ip du serveur apache via le fichier /etc/hosts, ou encore mieux le serveur dns mis en place avant-hier.
|
||||||
|
|
||||||
Emplacement des fichiers web: /srv/formation/www
|
## Atelier 1
|
||||||
|
|
||||||
Fichier /srv/formation/www/index.html contenant "Bienvenue sur formation.opendoor.fr"
|
Nom du fichier de conf: /etc/httpd/conf.d/formation1.lia.fr.conf
|
||||||
|
|
||||||
Emplacement des logs d'accès: /srv/formation/logs
|
Nom du serveur: formation1.lia.fr
|
||||||
|
|
||||||
Affichage des stats via url /status
|
Emplacement des fichiers web: /srv/formation1.lia.fr/www
|
||||||
|
|
||||||
Affichage de la config via url /config
|
Emplacement des logs d'accès: /srv/formation1.lia.fr/logs/access_log
|
||||||
|
|
||||||
|
Emplacement des logs d'erreur: /srv/formation1.lia.fr/logs/error_log
|
||||||
|
|
||||||
|
Affichage des stats via url /status, accessible uniquement depuis _local_
|
||||||
|
```bash
|
||||||
|
<VirttualHost *>
|
||||||
|
ServerName formation1.lia.fr
|
||||||
|
ServerAdmin root@formation1.lia.fr
|
||||||
|
DocumentRoot /srv/formation1.lia.fr/www
|
||||||
|
ErrorLog /srv/formation1.lia.fr/logs/error_log
|
||||||
|
CustomLog /srv/formation1.lia.fr/logs/access_log combined
|
||||||
|
|
||||||
|
<Directory />
|
||||||
|
require all denied
|
||||||
|
Options None
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory /srv/formation1.lia.fr/www>
|
||||||
|
Require all granted
|
||||||
|
Options +indexes
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Location /status>
|
||||||
|
SetHandler server-status
|
||||||
|
Require local
|
||||||
|
</Location>
|
||||||
|
</VirtualHost>
|
||||||
|
```
|
||||||
|
## Atelier 2
|
||||||
|
|
||||||
|
Faire la même chose pour héberger /etc/httpd/conf.d/formation2.lia.fr.conf
|
||||||
|
|
||||||
|
Comment mutualiser les éléments identiques ? (par exemple la partie concernant server-status)
|
||||||
|
|
||||||
|
> on déplace le bloc concernant "location status" dans un fichier à part, qu'on inclue directement dans /etc/httpd/conf.d ou via une directive include
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
#! /bin/bash
|
|
||||||
# this script is meant to be run by ansible
|
|
||||||
|
|
||||||
source /root/functions.sh
|
|
||||||
# check that alias has been tried
|
|
||||||
addHeader
|
|
||||||
fileMustExist /etc/httpd/conf.d/cours.opendoor.fr.conf
|
|
||||||
dirMustExist /srv/cours/www
|
|
||||||
dirMustExist /srv/cours/logs
|
|
||||||
pkgInstalled httpd
|
|
||||||
serviceIsEnabled httpd
|
|
||||||
serviceIsActive httpd
|
|
||||||
okIfCurl http://localhost/status "Apache Server Status for localhost"
|
|
||||||
okIfCurl http://localhost/config "strong>MPM Name"
|
|
||||||
Reference in New Issue
Block a user