Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
727d520996 |
@@ -1,53 +1,19 @@
|
||||
# VirtualHost
|
||||
# Vhost
|
||||
|
||||
## Introduction
|
||||
Mettre en place le vhost _formation.opendoor.fr_ en respectant les conditions suivantes:
|
||||
|
||||
Mise en place du site _formation1.lia.fr_
|
||||
Fichier de configuration: /etc/apache2/sites-available/formation.opendoor.fr.conf
|
||||
|
||||
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.
|
||||
Nom du serveur: formation.opendoor.fr
|
||||
|
||||
## Atelier 1
|
||||
Emplacement des fichiers web: /srv/formation/www
|
||||
|
||||
Nom du fichier de conf: /etc/httpd/conf.d/formation1.lia.fr.conf
|
||||
Fichier /srv/formation/www/index.html contenant "Bienvenue sur formation.opendoor.fr"
|
||||
|
||||
Nom du serveur: formation1.lia.fr
|
||||
Emplacement des logs d'accès: /srv/formation/logs
|
||||
|
||||
Emplacement des fichiers web: /srv/formation1.lia.fr/www
|
||||
Affichage des stats via url /status
|
||||
|
||||
Emplacement des logs d'accès: /srv/formation1.lia.fr/logs/access_log
|
||||
Affichage de la config via url /config
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#! /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