Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| elearning:workbooks:centos:6:senior:l103 [2020/02/21 07:28] – créée admin | elearning:workbooks:centos:6:senior:l103 [2021/10/19 14:29] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 2: | Ligne 2: | ||
| ======SER202 - Gestion du Serveur Web Apache 2.4====== | ======SER202 - Gestion du Serveur Web Apache 2.4====== | ||
| + | |||
| + | =====Prérequis===== | ||
| + | |||
| + | ==== Matériel==== | ||
| + | |||
| + | * Un poste (MacOS, Linux, Windows(tm) ou Solaris(tm)), | ||
| + | * Clavier AZERTY FR ou QWERTY US, | ||
| + | * 4 Go de RAM minimum, | ||
| + | * Processeur 2 cœurs minimum, | ||
| + | * Un casque ou des écouteurs, | ||
| + | * Un micro (optionnel). | ||
| + | |||
| + | ====Logiciels==== | ||
| + | |||
| + | * Si Windows(tm) - Putty et WinSCP, | ||
| + | * Navigateur Web Chrome, Edge ou Firefox. | ||
| + | |||
| + | ====Internet==== | ||
| + | |||
| + | * Un accès à Internet **rapide** (4G minimum) **sans** passer par un proxy, | ||
| + | * Accès **débloqué** aux domaines suivants : https:// | ||
| + | * Ports accessibles : 80,443. | ||
| + | |||
| + | =====Utilisation de l' | ||
| + | |||
| + | Au départ de votre formation, votre formateur vous attribue un ID allant de Trainee01 à Trainee10. | ||
| + | |||
| + | Pour avoir accès à vos machines virtuelles, vous devez d' | ||
| + | |||
| + | ^ ID ^ URL ( Notez http: et non https: ) ^ | ||
| + | | Trainee01 | http:// | ||
| + | | Trainee02 | http:// | ||
| + | | Trainee03 | http:// | ||
| + | | Trainee04 | http:// | ||
| + | | Trainee05 | http:// | ||
| + | | Trainee06 | http:// | ||
| + | | Trainee07 | http:// | ||
| + | | Trainee08 | http:// | ||
| + | | Trainee09 | http:// | ||
| + | | Trainee10 | http:// | ||
| + | |||
| + | Dans la boîte de connexion, entrez votre ID et le mot de passe qui vous a été **fourni par votre formateur**. | ||
| + | |||
| + | Cliquez ensuite sur la connexion **Gateway_SSH**. | ||
| + | |||
| + | Dernièrement connectez-vous à la première machine virtuelle utilisée pour cette formation : | ||
| + | |||
| + | $ ssh -l trainee 10.0.2.51 | ||
| + | |||
| + | Les adresses IP des machines virtuelles sont : | ||
| + | |||
| + | ^ Machine ^ Nom d' | ||
| + | | CentOS7| centos7.i2tch.loc | 10.0.2.51 | | ||
| + | | Debian9 | debian9.i2tch.loc | 10.0.2.60 | | ||
| + | |||
| + | Les noms d' | ||
| + | |||
| + | ^ Utilisateur ^ Mot de Passe ^ | ||
| + | | trainee | trainee | | ||
| + | | root | fenestros | | ||
| + | |||
| + | =====Programme de la Formation===== | ||
| + | |||
| + | * **SER202 - Gestion du Serveur Web Apache 2.4** | ||
| + | * Présentation d' | ||
| + | * Présentation et Configuration d' | ||
| + | * Préparation | ||
| + | * Installation à partir des dépôts | ||
| + | * Configuration | ||
| + | * Etude des directives du fichier / | ||
| + | * Etude des directives du fichier / | ||
| + | * Etude des directives du fichier / | ||
| + | * Etude des directives du fichier / | ||
| + | * Application de la Configuration | ||
| + | * Présentation et Configuration d' | ||
| + | * Installation à partir des dépôts | ||
| + | * Configuration | ||
| + | * Etude des directives du fichier / | ||
| + | * Etude des directives du fichier / | ||
| + | * Etude des directives du fichier / | ||
| + | * Etude des directives du fichier / | ||
| + | * Etude des directives du fichier / | ||
| + | * Etude des directives du fichier / | ||
| + | * Etude des directives du fichier / | ||
| + | * Etude des directives du fichier / | ||
| + | * Etude des directives du fichier / | ||
| + | * Administration de Base | ||
| + | * LAB #1 - Gestion de serveurs virtuels | ||
| + | * Sous RHEL / CentOS 7 | ||
| + | * Hôte virtuel par nom | ||
| + | * Hôte virtuel par adresse IP | ||
| + | * Hôtes Virtuels Dynamiques avec mod_vhost_alias | ||
| + | * Sous Debian 9 | ||
| + | * Hôte virtuel par nom | ||
| + | * Hôte virtuel par adresse IP | ||
| + | * Hôtes Virtuels Dynamiques avec mod_vhost_alias | ||
| + | * LAB #2 - Gestion des pages personnelles avec mod_userdir | ||
| + | * Sous RHEL / CentOS 7 | ||
| + | * Sous Debian 9 | ||
| + | * Administration Avancée | ||
| + | * LAB #3 - Gestion des pages dynamiques avec mod_php | ||
| + | * LAB #4 - Gestion de l' | ||
| + | * LAB #5 - Gestion de l' | ||
| + | * LAB #6 - Gestion de l' | ||
| + | * LAB #7 - Gestion des pages web sécurisées en https avec mod_ssl | ||
| + | * LAB #8 - Gestion d'un Serveur Mandataire avec mod_proxy | ||
| + | * LAB #9 - Gestion du Web-based Distributed Authoring and Versioning avec mod_dav | ||
| + | * LAB #10 - Gestion de la réécriture d'URL avec mod_rewrite | ||
| + | * LAB #11 - Personnalisation des en-têtes de requêtes et de réponses HTTP avec mod_header | ||
| + | * LAB #12 - L' | ||
| + | * LAB #13 - Améliorer l' | ||
| =====Présentation d' | =====Présentation d' | ||
| Ligne 26: | Ligne 137: | ||
| **Ces modules sont compilés statiquement au binaire Apache et sont mutuellement exclusifs.** | **Ces modules sont compilés statiquement au binaire Apache et sont mutuellement exclusifs.** | ||
| - | =====Contenu de ce Cours===== | + | =====Présentation et Configuration d' |
| - | Dans ce cours, vous allez apprendre par la pratique : | + | ====Préparation==== |
| - | + | ||
| - | * LAB #1 - Gestion de serveurs virtuels | + | |
| - | * LAB #2 - Gestion des pages personnelles avec mod_userdir | + | |
| - | * LAB #3 - Gestion des pages dynamiques avec mod_php | + | |
| - | * LAB #4 - Gestion de l' | + | |
| - | * LAB #5 - Gestion de l' | + | |
| - | * LAB #6 - Gestion de l' | + | |
| - | * LAB #7 - Gestion des pages web sécurisées en https avec mod_ssl | + | |
| - | * LAB #8 - Gestion d'un Serveur Mandataire avec mod_proxy | + | |
| - | * LAB #9 - Gestion avec Content Caching avec mod_cache et mod_cache_disk | + | |
| - | * LAB #10 - Gestion d'un Reverse Proxy avec mod_proxy | + | |
| - | * LAB #11 - Gestion du Web-based Distributed Authoring and Versioning avec mod_dav | + | |
| - | * LAB #12 - Gestion de la réécriture d'URL avec mod_rewrite | + | |
| - | * LAB #13 - Personnalisation des en-têtes de requêtes et de réponses HTTP avec mod_header | + | |
| - | * LAB #14 - L' | + | |
| - | * LAB #15 - Améliorer l' | + | |
| - | + | ||
| - | =====Préparation===== | + | |
| Désactivez le mode **enforcing** de SELINUX afin de pouvoir librement travailler avec Apache : | Désactivez le mode **enforcing** de SELINUX afin de pouvoir librement travailler avec Apache : | ||
| Ligne 87: | Ligne 180: | ||
| </ | </ | ||
| - | ===== Installation à partir des dépôts===== | + | ==== Installation à partir des dépôts==== |
| Sous **RHEL / CentOS 7**, Apache n'est pas installé par défaut. Utilisez donc yum pour l' | Sous **RHEL / CentOS 7**, Apache n'est pas installé par défaut. Utilisez donc yum pour l' | ||
| Ligne 142: | Ligne 235: | ||
| </ | </ | ||
| - | =====Configuration | + | ====Configuration==== |
| - | + | ||
| - | ====/ | + | |
| Sous Red Hat / CentOS 7 le fichier de configuration principal d' | Sous Red Hat / CentOS 7 le fichier de configuration principal d' | ||
| Ligne 181: | Ligne 272: | ||
| -rw-r--r--. 1 root root 451 Apr 12 15:50 01-cgi.conf | -rw-r--r--. 1 root root 451 Apr 12 15:50 01-cgi.conf | ||
| </ | </ | ||
| + | |||
| + | ===/ | ||
| Les directives actives du fichier **/ | Les directives actives du fichier **/ | ||
| Ligne 245: | Ligne 338: | ||
| IncludeOptional conf.d/ | IncludeOptional conf.d/ | ||
| </ | </ | ||
| - | |||
| - | ====Les Directives du fichier / | ||
| ===ServerRoot=== | ===ServerRoot=== | ||
| Ligne 634: | Ligne 725: | ||
| </ | </ | ||
| - | =====/ | + | ====/ |
| Les directives actives du fichier **/ | Les directives actives du fichier **/ | ||
| Ligne 680: | Ligne 771: | ||
| </ | </ | ||
| - | ====Les Directives | + | Les directives actives |
| + | |||
| + | < | ||
| + | [root@centos7 ~]# egrep -v ' | ||
| + | [root@centos7 ~]# cat / | ||
| + | IndexOptions FancyIndexing HTMLTable VersionSort | ||
| + | Alias /icons/ "/ | ||
| + | < | ||
| + | Options Indexes MultiViews FollowSymlinks | ||
| + | AllowOverride None | ||
| + | Require all granted | ||
| + | </ | ||
| + | AddIconByEncoding (CMP,/ | ||
| + | AddIconByType (TXT,/ | ||
| + | AddIconByType (IMG,/ | ||
| + | AddIconByType (SND,/ | ||
| + | AddIconByType (VID,/ | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | AddIcon / | ||
| + | DefaultIcon / | ||
| + | ReadmeName README.html | ||
| + | HeaderName HEADER.html | ||
| + | IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t | ||
| + | </ | ||
| ===IndexOptions=== | ===IndexOptions=== | ||
| Ligne 789: | Ligne 922: | ||
| </ | </ | ||
| - | =====/ | + | ====/ |
| Ce fichier configure la mise à disposition de pages personnelles pour chaque utilisateur ayant un compte sur le serveur Linux. | Ce fichier configure la mise à disposition de pages personnelles pour chaque utilisateur ayant un compte sur le serveur Linux. | ||
| Ligne 807: | Ligne 940: | ||
| </ | </ | ||
| </ | </ | ||
| - | |||
| - | ====Les Directives du fichier / | ||
| ===< | ===< | ||
| Ligne 826: | Ligne 957: | ||
| </ | </ | ||
| - | =====/ | + | ====/ |
| Ce fichier configure l' | Ce fichier configure l' | ||
| Ligne 850: | Ligne 981: | ||
| </ | </ | ||
| - | =====/ | + | ====/ |
| Ces fichiers configurent le chargement des modules d' | Ces fichiers configurent le chargement des modules d' | ||
| Ligne 918: | Ligne 1049: | ||
| </ | </ | ||
| - | =====/ | + | ====/ |
| Afin de complémenter la configuration de base d' | Afin de complémenter la configuration de base d' | ||
| Ligne 994: | Ligne 1125: | ||
| </ | </ | ||
| </ | </ | ||
| - | |||
| - | ====Les Directives du fichier / | ||
| Dans ce fichier on trouve les directives suivantes : | Dans ce fichier on trouve les directives suivantes : | ||
| Ligne 1224: | Ligne 1353: | ||
| < | < | ||
| - | 10.0.2.15 i2tch.loc | + | 10.0.2.51 i2tch.loc |
| - | 10.0.2.15 www.i2tch.loc | + | 10.0.2.51 www.i2tch.loc |
| </ | </ | ||
| Ligne 1257: | Ligne 1386: | ||
| </ | </ | ||
| - | =====Configuration sous Debian | + | =====Présentation et Configuration |
| + | |||
| + | ===== Installation à partir des dépôts===== | ||
| + | |||
| + | Si Apache n'est pas déjà installé, utilisez **apt** pour installer le paquet **apache2**. | ||
| + | |||
| + | =====Configuration===== | ||
| - | Sous Debian | + | Sous Debian |
| < | < | ||
| - | root@debian8:~# ls -l / | + | root@debian9:~# ls -l / |
| total 80 | total 80 | ||
| -rw-r--r-- 1 root root 7115 Mar 31 10:17 apache2.conf | -rw-r--r-- 1 root root 7115 Mar 31 10:17 apache2.conf | ||
| Ligne 1274: | Ligne 1409: | ||
| drwxr-xr-x 2 root root 4096 Aug 27 11:08 sites-available | drwxr-xr-x 2 root root 4096 Aug 27 11:08 sites-available | ||
| drwxr-xr-x 2 root root 4096 Aug 27 11:08 sites-enabled | drwxr-xr-x 2 root root 4096 Aug 27 11:08 sites-enabled | ||
| - | root@debian8:~# | + | root@debian9:~# |
| - | root@debian8:~# ls -lR / | + | root@debian9:~# ls -lR / |
| / | / | ||
| total 80 | total 80 | ||
| Ligne 1485: | Ligne 1620: | ||
| < | < | ||
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| # This is the main Apache server configuration file. It contains the | # This is the main Apache server configuration file. It contains the | ||
| # configuration directives that give the server its instructions. | # configuration directives that give the server its instructions. | ||
| Ligne 1712: | Ligne 1847: | ||
| < | < | ||
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| # Read the documentation before enabling AddDefaultCharset. | # Read the documentation before enabling AddDefaultCharset. | ||
| # In general, it is only a good idea if you know that all your files | # In general, it is only a good idea if you know that all your files | ||
| Ligne 1726: | Ligne 1861: | ||
| < | < | ||
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| # Customizable error responses come in three flavors: | # Customizable error responses come in three flavors: | ||
| # 1) plain text | # 1) plain text | ||
| Ligne 1813: | Ligne 1948: | ||
| < | < | ||
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| # Define an access log for VirtualHosts that don't define their own logfile | # Define an access log for VirtualHosts that don't define their own logfile | ||
| CustomLog ${APACHE_LOG_DIR}/ | CustomLog ${APACHE_LOG_DIR}/ | ||
| Ligne 1823: | Ligne 1958: | ||
| < | < | ||
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| # | # | ||
| # Disable access to the entire file system except for the directories that | # Disable access to the entire file system except for the directories that | ||
| Ligne 1903: | Ligne 2038: | ||
| < | < | ||
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| < | < | ||
| < | < | ||
| Ligne 1929: | Ligne 2064: | ||
| < | < | ||
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| # envvars - default environment variables for apache2ctl | # envvars - default environment variables for apache2ctl | ||
| Ligne 1982: | Ligne 2117: | ||
| < | < | ||
| - | root@debian8:~# more / | + | root@debian9:~# more / |
| # Magic data for mod_mime_magic (originally for file(1) command) | # Magic data for mod_mime_magic (originally for file(1) command) | ||
| # | # | ||
| Ligne 2028: | Ligne 2163: | ||
| < | < | ||
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| # If you just change the port or add more ports here, you will likely also | # If you just change the port or add more ports here, you will likely also | ||
| # have to change the VirtualHost statement in | # have to change the VirtualHost statement in | ||
| Ligne 2149: | Ligne 2284: | ||
| 127.0.0.1 localhost.localdomain localhost | 127.0.0.1 localhost.localdomain localhost | ||
| :: | :: | ||
| - | 10.0.2.15 i2tch.loc | + | 10.0.2.51 i2tch.loc |
| - | 10.0.2.15 www.i2tch.loc | + | 10.0.2.51 www.i2tch.loc |
| - | 10.0.2.15 www.rhelnom.com | + | 10.0.2.51 www.rhelnom.com |
| </ | </ | ||
| Ligne 2240: | Ligne 2375: | ||
| < | < | ||
| [root@centos7 ~]# cat / | [root@centos7 ~]# cat / | ||
| - | 10.0.2.15 - - [24/ | + | 10.0.2.51 - - [24/ |
| </ | </ | ||
| ==Hôte virtuel par adresse IP== | ==Hôte virtuel par adresse IP== | ||
| - | |||
| - | Commencez par créer une adresse IP fixe : | ||
| - | |||
| - | < | ||
| - | [root@centos7 ~]# nmcli connection add con-name ip_fixe ifname enp0s3 type ethernet ip4 10.0.2.16/ | ||
| - | [root@centos7 ~]# nmcli connection up ip_fixe | ||
| - | [root@centos7 ~]# nmcli connection mod ip_fixe ipv4.dns 8.8.8.8 | ||
| - | [root@centos7 ~]# systemctl restart NetworkManager | ||
| - | [root@centos7 ~]# nslookup www.free.fr | ||
| - | Server: | ||
| - | Address: | ||
| - | |||
| - | Non-authoritative answer: | ||
| - | Name: | ||
| - | Address: 212.27.48.10 | ||
| - | </ | ||
| Vous allez maintenant procéder à la création d'un site ( hôte ) virtuel par adresse IP. Normalement, | Vous allez maintenant procéder à la création d'un site ( hôte ) virtuel par adresse IP. Normalement, | ||
| Ligne 2266: | Ligne 2385: | ||
| [root@centos7 ~]# ip a | grep 'inet ' | [root@centos7 ~]# ip a | grep 'inet ' | ||
| inet 127.0.0.1/8 scope host lo | inet 127.0.0.1/8 scope host lo | ||
| - | inet 10.0.2.16/24 brd 10.0.2.255 scope global | + | inet 10.0.2.51/24 brd 10.0.2.255 scope global |
| - | [root@centos7 ~]# ip a add 192.168.1.99/ | + | [root@centos7 ~]# ip a add 192.168.1.99/ |
| [root@centos7 ~]# ip a | grep 'inet ' | [root@centos7 ~]# ip a | grep 'inet ' | ||
| inet 127.0.0.1/8 scope host lo | inet 127.0.0.1/8 scope host lo | ||
| - | inet 10.0.2.16/24 brd 10.0.2.255 scope global | + | inet 10.0.2.51/24 brd 10.0.2.255 scope global |
| - | inet 192.168.1.99/ | + | inet 192.168.1.99/ |
| </ | </ | ||
| Ligne 2344: | Ligne 2463: | ||
| 127.0.0.1 localhost.localdomain localhost | 127.0.0.1 localhost.localdomain localhost | ||
| :: | :: | ||
| - | 10.0.2.16 i2tch.loc | + | 10.0.2.51 i2tch.loc |
| - | 10.0.2.16 www.i2tch.loc | + | 10.0.2.51 www.i2tch.loc |
| - | 10.0.2.16 www.rhelnom.com | + | 10.0.2.51 www.rhelnom.com |
| 192.168.1.99 | 192.168.1.99 | ||
| </ | </ | ||
| Ligne 2463: | Ligne 2582: | ||
| < | < | ||
| - | root@debian8:~# systemctl restart | + | [root@centos7 |
| </ | </ | ||
| Ligne 2469: | Ligne 2588: | ||
| < | < | ||
| - | root@debian8:~# mkdir / | + | [root@centos7 |
| </ | </ | ||
| Ligne 2511: | Ligne 2630: | ||
| < | < | ||
| - | root@debian8:~# chown -R apache: | + | [root@centos7 |
| </ | </ | ||
| Ligne 2528: | Ligne 2647: | ||
| < | < | ||
| - | root@debian8:~# systemctl restart NetworkManager | + | root@debian9:~# systemctl restart NetworkManager |
| </ | </ | ||
| Ligne 2551: | Ligne 2670: | ||
| [root@centos7 ~]# lynx --dump http:// | [root@centos7 ~]# lynx --dump http:// | ||
| - | Accueil du Project | + | Accueil du Project |
| Ligne 2561: | Ligne 2680: | ||
| </ | </ | ||
| - | ===Sous Debian | + | ===Sous Debian |
| ==Hôte virtuel par nom== | ==Hôte virtuel par nom== | ||
| - | Sous **Debian | + | Sous **Debian |
| < | < | ||
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| < | < | ||
| ServerName debiannom.com | ServerName debiannom.com | ||
| Ligne 2590: | Ligne 2709: | ||
| < | < | ||
| - | root@debian8:~# mkdir -p /www/site1 | + | root@debian9:~# mkdir -p /www/site1 |
| </ | </ | ||
| Ligne 2596: | Ligne 2715: | ||
| < | < | ||
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| < | < | ||
| < | < | ||
| Ligne 2614: | Ligne 2733: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:~# chown -R www-data: |
| </ | </ | ||
| Ligne 2620: | Ligne 2739: | ||
| < | < | ||
| - | root@debian8:~# cd / | + | root@debian9:~# cd / |
| - | root@debian8:/ | + | root@debian9:/ |
| - | root@debian8:/ | + | root@debian9:/ |
| total 0 | total 0 | ||
| lrwxrwxrwx 1 root root 35 Aug 27 11:08 000-default.conf -> ../ | lrwxrwxrwx 1 root root 35 Aug 27 11:08 000-default.conf -> ../ | ||
| Ligne 2631: | Ligne 2750: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| </ | </ | ||
| Ligne 2637: | Ligne 2756: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| - | root@debian8:/ | + | root@debian9:/ |
| 127.0.0.1 localhost | 127.0.0.1 localhost | ||
| 127.0.1.1 debian8.fenestros.loc debian8 | 127.0.1.1 debian8.fenestros.loc debian8 | ||
| Ligne 2646: | Ligne 2765: | ||
| ff02::1 ip6-allnodes | ff02::1 ip6-allnodes | ||
| ff02::2 ip6-allrouters | ff02::2 ip6-allrouters | ||
| - | 10.0.2.15 i2tch.loc | + | 10.0.2.60 i2tch.loc |
| - | 10.0.2.15 www.i2tch.loc | + | 10.0.2.60 www.i2tch.loc |
| - | 10.0.2.15 www.debiannom.com | + | 10.0.2.60 www.debiannom.com |
| </ | </ | ||
| Ligne 2654: | Ligne 2773: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| </ | </ | ||
| Ligne 2660: | Ligne 2779: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| Accueil du site 1 | Accueil du site 1 | ||
| - | root@debian8:/ | + | root@debian9:/ |
| </ | </ | ||
| Ligne 2700: | Ligne 2819: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| </ | </ | ||
| Ligne 2706: | Ligne 2825: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| </ | </ | ||
| Ligne 2712: | Ligne 2831: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| </ | </ | ||
| Ligne 2718: | Ligne 2837: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| Accueil du site 1 | Accueil du site 1 | ||
| - | root@debian8:/ | + | root@debian9:/ |
| </ | </ | ||
| Ligne 2728: | Ligne 2847: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| total 4 | total 4 | ||
| -rw-r--r-- 1 root root 0 Aug 27 19:34 debiannom_error.log | -rw-r--r-- 1 root root 0 Aug 27 19:34 debiannom_error.log | ||
| Ligne 2739: | Ligne 2858: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| - | 10.0.2.15 - - [27/ | + | 10.0.2.60 - - [27/ |
| </ | </ | ||
| ==Hôte virtuel par adresse IP== | ==Hôte virtuel par adresse IP== | ||
| - | |||
| - | NetworkManager inclus la notion de **connections** ou **profils** permettant des configurations différentes en fonction de la localisation. Pour voir les connections actuelles, utilisez la commande **nmcli c** avec la sous-commande **show** : | ||
| - | |||
| - | Si vous constatez que vous n'avez pas de profil dans la sortie de la commande **nmcli c show**, ceci indique que NetworkManager ne gère pas la carte : | ||
| - | |||
| - | < | ||
| - | root@debian8:/ | ||
| - | root@debian8: | ||
| - | NAME | ||
| - | </ | ||
| - | |||
| - | Dans ce cas, le fichier **/ | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | # This file describes the network interfaces available on your system | ||
| - | # and how to activate them. For more information, | ||
| - | |||
| - | source / | ||
| - | |||
| - | # The loopback network interface | ||
| - | auto lo | ||
| - | iface lo inet loopback | ||
| - | |||
| - | # The primary network interface | ||
| - | allow-hotplug eth0 | ||
| - | iface eth0 inet dhcp | ||
| - | </ | ||
| - | |||
| - | Afin de permettre NetworkManager de gérer la carte malgré cette configuration, | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | root@debian8: | ||
| - | [main] | ||
| - | plugins=ifupdown, | ||
| - | |||
| - | [ifupdown] | ||
| - | managed=true | ||
| - | </ | ||
| - | |||
| - | Il faut ensuite re-démarrer le service NetworkManager : | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | </ | ||
| - | |||
| - | Constatez la sortie de la commande **nmcli c show** : | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | NAME | ||
| - | eth0 | ||
| - | Ifupdown (eth0) | ||
| - | </ | ||
| - | |||
| - | Créez maintenant un profil IP fixe rattaché au périphérique **eth0** : | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | Connection ' | ||
| - | </ | ||
| - | |||
| - | Constatez sa présence : | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | NAME | ||
| - | ip_fixe | ||
| - | eth0 | ||
| - | Ifupdown (eth0) | ||
| - | </ | ||
| - | |||
| - | L' | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | [connection] | ||
| - | id=ip_fixe | ||
| - | uuid=0421e288-cb7c-4569-ac1f-70598a13c96f | ||
| - | interface-name=eth0 | ||
| - | type=ethernet | ||
| - | |||
| - | [ipv4] | ||
| - | method=manual | ||
| - | address1=10.0.2.16/ | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | ping: unknown host www.free.fr | ||
| - | </ | ||
| - | |||
| - | Modifiez donc la configuration du profil **ip_fixe** : | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | </ | ||
| - | |||
| - | L' | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | [connection] | ||
| - | id=ip_fixe | ||
| - | uuid=0421e288-cb7c-4569-ac1f-70598a13c96f | ||
| - | interface-name=eth0 | ||
| - | type=ethernet | ||
| - | |||
| - | [ipv6] | ||
| - | method=auto | ||
| - | |||
| - | [ipv4] | ||
| - | method=manual | ||
| - | dns=8.8.8.8; | ||
| - | address1=10.0.2.16/ | ||
| - | </ | ||
| - | |||
| - | Afin que la modification du serveur DNS soit prise en compte, re-démarrez le service NetworkManager : | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | root@debian8: | ||
| - | root@debian8: | ||
| - | ● NetworkManager.service - Network Manager | ||
| - | | ||
| - | | ||
| - | Main PID: 32570 (NetworkManager) | ||
| - | | ||
| - | | ||
| - | |||
| - | Aug 27 20:04:16 debian8 NetworkManager[32570]: | ||
| - | Aug 27 20:04:16 debian8 NetworkManager[32570]: | ||
| - | Aug 27 20:04:16 debian8 NetworkManager[32570]: | ||
| - | Aug 27 20:04:16 debian8 NetworkManager[32570]: | ||
| - | Aug 27 20:04:16 debian8 NetworkManager[32570]: | ||
| - | Aug 27 20:04:16 debian8 NetworkManager[32570]: | ||
| - | Aug 27 20:04:16 debian8 NetworkManager[32570]: | ||
| - | Aug 27 20:04:16 debian8 NetworkManager[32570]: | ||
| - | Aug 27 20:04:16 debian8 NetworkManager[32570]: | ||
| - | Aug 27 20:04:22 debian8 NetworkManager[32570]: | ||
| - | </ | ||
| - | |||
| - | Vérifiez la resolution des noms : | ||
| - | |||
| - | < | ||
| - | root@debian8: | ||
| - | PING www.free.fr (212.27.48.10) 56(84) bytes of data. | ||
| - | 64 bytes from www.free.fr (212.27.48.10): | ||
| - | 64 bytes from www.free.fr (212.27.48.10): | ||
| - | 64 bytes from www.free.fr (212.27.48.10): | ||
| - | 64 bytes from www.free.fr (212.27.48.10): | ||
| - | ^C | ||
| - | --- www.free.fr ping statistics --- | ||
| - | 4 packets transmitted, | ||
| - | rtt min/ | ||
| - | </ | ||
| Vous allez maintenant procéder à la création d'un site ( hôte ) virtuel par adresse IP. Normalement, | Vous allez maintenant procéder à la création d'un site ( hôte ) virtuel par adresse IP. Normalement, | ||
| < | < | ||
| - | root@debian8:~# ip a | grep 'inet ' | + | root@debian9:/ |
| + | root@debian9:~# ip a | grep 'inet ' | ||
| inet 127.0.0.1/8 scope host lo | inet 127.0.0.1/8 scope host lo | ||
| - | inet 10.0.2.15/24 brd 10.0.2.255 scope global | + | inet 10.0.2.60/24 brd 10.0.2.255 scope global |
| - | root@debian8:~# ip a add 192.168.1.99/ | + | root@debian9:~# ip a add 192.168.1.99/ |
| - | root@debian8:~# ip a | grep 'inet ' | + | root@debian9:~# ip a | grep 'inet ' |
| inet 127.0.0.1/8 scope host lo | inet 127.0.0.1/8 scope host lo | ||
| - | inet 10.0.2.15/24 brd 10.0.2.255 scope global | + | inet 10.0.2.60/24 brd 10.0.2.255 scope global |
| - | inet 192.168.1.99/ | + | inet 192.168.1.99/ |
| </ | </ | ||
| Ligne 2918: | Ligne 2881: | ||
| < | < | ||
| - | root@debian8:~# mkdir /www/site2 | + | root@debian9:~# mkdir /www/site2 |
| </ | </ | ||
| Ligne 2924: | Ligne 2887: | ||
| < | < | ||
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| < | < | ||
| < | < | ||
| Ligne 2936: | Ligne 2899: | ||
| < | < | ||
| - | root@debian8:~# mkdir / | + | root@debian9:~# mkdir / |
| </ | </ | ||
| Ligne 2942: | Ligne 2905: | ||
| < | < | ||
| - | root@debian8:~# chown -R www-data: | + | root@debian9:~# chown -R www-data: |
| </ | </ | ||
| Ligne 2948: | Ligne 2911: | ||
| < | < | ||
| - | root@debian8:~# cp / | + | root@debian9:~# cp / |
| </ | </ | ||
| Ligne 2954: | Ligne 2917: | ||
| < | < | ||
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| < | < | ||
| ServerName debianip.com | ServerName debianip.com | ||
| Ligne 2979: | Ligne 2942: | ||
| < | < | ||
| - | root@debian8:~# cd / | + | root@debian9:~# cd / |
| - | root@debian8:/ | + | root@debian9:/ |
| </ | </ | ||
| Ligne 2986: | Ligne 2949: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| - | root@debian8:/ | + | root@debian9:/ |
| 127.0.0.1 localhost | 127.0.0.1 localhost | ||
| 127.0.1.1 debian8.fenestros.loc debian8 | 127.0.1.1 debian8.fenestros.loc debian8 | ||
| Ligne 2995: | Ligne 2958: | ||
| ff02::1 ip6-allnodes | ff02::1 ip6-allnodes | ||
| ff02::2 ip6-allrouters | ff02::2 ip6-allrouters | ||
| - | 10.0.2.16 i2tch.loc | + | 10.0.2.60 i2tch.loc |
| - | 10.0.2.16 www.i2tch.loc | + | 10.0.2.60 www.i2tch.loc |
| - | 10.0.2.16 www.debiannom.com | + | 10.0.2.60 www.debiannom.com |
| 192.168.1.99 www.debianip.com | 192.168.1.99 www.debianip.com | ||
| </ | </ | ||
| Ligne 3004: | Ligne 2967: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| </ | </ | ||
| Ligne 3010: | Ligne 2973: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| Accueil du site 2 | Accueil du site 2 | ||
| - | root@debian8:/ | + | root@debian9:/ |
| </ | </ | ||
| Ligne 3020: | Ligne 2983: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| total 4 | total 4 | ||
| -rw-r--r-- 1 root root 0 Aug 27 22:14 debianip_error.log | -rw-r--r-- 1 root root 0 Aug 27 22:14 debianip_error.log | ||
| -rw-r--r-- 1 root root 134 Aug 27 22:17 debianip.log | -rw-r--r-- 1 root root 134 Aug 27 22:17 debianip.log | ||
| - | root@debian8:/ | + | root@debian9:/ |
| 192.168.1.99 - - [27/ | 192.168.1.99 - - [27/ | ||
| </ | </ | ||
| Ligne 3033: | Ligne 2996: | ||
| < | < | ||
| - | root@debian8:/ | + | root@debian9:/ |
| - | root@debian8:~# apt-get install dnsmasq | + | root@debian9:~# apt-get install dnsmasq |
| </ | </ | ||
| Ligne 3040: | Ligne 3003: | ||
| < | < | ||
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| listen-address=127.0.0.1 | listen-address=127.0.0.1 | ||
| address=/ | address=/ | ||
| Ligne 3049: | Ligne 3012: | ||
| < | < | ||
| - | root@debian8:~# systemctl restart dnsmasq | + | root@debian9:~# systemctl restart dnsmasq |
| </ | </ | ||
| Ligne 3055: | Ligne 3018: | ||
| < | < | ||
| - | root@debian8:~# a2enmod vhost_alias | + | root@debian9:~# a2enmod vhost_alias |
| Enabling module vhost_alias. | Enabling module vhost_alias. | ||
| To activate the new configuration, | To activate the new configuration, | ||
| service apache2 restart | service apache2 restart | ||
| - | root@debian8:~# | + | root@debian9:~# |
| - | root@debian8:~# a2enmod rewrite | + | root@debian9:~# a2enmod rewrite |
| Enabling module rewrite. | Enabling module rewrite. | ||
| To activate the new configuration, | To activate the new configuration, | ||
| Ligne 3069: | Ligne 3032: | ||
| < | < | ||
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| < | < | ||
| Ligne 3097: | Ligne 3060: | ||
| < | < | ||
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| RewriteEngine On | RewriteEngine On | ||
| RewriteBase / | RewriteBase / | ||
| Ligne 3106: | Ligne 3069: | ||
| < | < | ||
| - | root@debian8:~# systemctl restart apache2 | + | root@debian9:~# systemctl restart apache2 |
| </ | </ | ||
| Ligne 3112: | Ligne 3075: | ||
| < | < | ||
| - | root@debian8:~# mkdir / | + | root@debian9:~# mkdir / |
| </ | </ | ||
| Ligne 3118: | Ligne 3081: | ||
| < | < | ||
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| < | < | ||
| < | < | ||
| Ligne 3130: | Ligne 3093: | ||
| < | < | ||
| - | root@debian8:~# mkdir / | + | root@debian9:~# mkdir / |
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| < | < | ||
| < | < | ||
| Ligne 3141: | Ligne 3104: | ||
| < | < | ||
| - | root@debian8:~# mkdir / | + | root@debian9:~# mkdir / |
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| < | < | ||
| < | < | ||
| Ligne 3154: | Ligne 3117: | ||
| < | < | ||
| - | root@debian8:~# chown -R www-data: | + | root@debian9:~# chown -R www-data: |
| </ | </ | ||
| Ligne 3160: | Ligne 3123: | ||
| < | < | ||
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| # Generated by NetworkManager | # Generated by NetworkManager | ||
| nameserver 127.0.0.1 | nameserver 127.0.0.1 | ||
| Ligne 3170: | Ligne 3133: | ||
| < | < | ||
| - | root@debian8:~# systemctl restart NetworkManager | + | root@debian9:~# systemctl restart NetworkManager |
| </ | </ | ||
| Ligne 3176: | Ligne 3139: | ||
| < | < | ||
| - | root@debian8:~# lynx --dump http:// | + | root@debian9:~# lynx --dump http:// |
| Accueil du site 1 | Accueil du site 1 | ||
| - | root@debian8:~# lynx --dump http:// | + | root@debian9:~# lynx --dump http:// |
| Accueil du site 2 | Accueil du site 2 | ||
| - | root@debian8:~# lynx --dump http:// | + | root@debian9:~# lynx --dump http:// |
| | | ||
| - | root@debian8:~# lynx --dump http:// | + | root@debian9:~# lynx --dump http:// |
| Accueil du Project A | Accueil du Project A | ||
| - | root@debian8:~# lynx --dump http:// | + | root@debian9:~# lynx --dump http:// |
| Accueil du Project B | Accueil du Project B | ||
| Ligne 3332: | Ligne 3295: | ||
| </ | </ | ||
| - | ===Sous Debian | + | ===Sous Debian |
| Pour qu' | Pour qu' | ||
| < | < | ||
| - | root@debian8:~# apachectl -M | grep userdir | + | root@debian9:~# apachectl -M | grep userdir |
| - | root@debian8:~# a2enmod userdir | + | root@debian9:~# a2enmod userdir |
| Enabling module userdir. | Enabling module userdir. | ||
| To activate the new configuration, | To activate the new configuration, | ||
| service apache2 restart | service apache2 restart | ||
| - | root@debian8:~# apachectl -M | grep userdir | + | root@debian9:~# apachectl -M | grep userdir |
| | | ||
| - | root@debian8:~# systemctl restart apache2 | + | root@debian9:~# systemctl restart apache2 |
| </ | </ | ||
| Ligne 3350: | Ligne 3313: | ||
| < | < | ||
| - | root@debian8:~# groupadd homepage | + | root@debian9:~# groupadd homepage |
| - | root@debian8:~# useradd homepage -m -c homepage -g homepage -d / | + | root@debian9:~# useradd homepage -m -c homepage -g homepage -d / |
| </ | </ | ||
| Ligne 3357: | Ligne 3320: | ||
| < | < | ||
| - | root@debian8:~# mkdir / | + | root@debian9:~# mkdir / |
| </ | </ | ||
| Ligne 3363: | Ligne 3326: | ||
| < | < | ||
| - | root@debian8:~# chown -R homepage: | + | root@debian9:~# chown -R homepage: |
| </ | </ | ||
| Ligne 3370: | Ligne 3333: | ||
| < | < | ||
| < | < | ||
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| < | < | ||
| - | UserDir public_html | + | |
| - | UserDir disabled root | + | UserDir disabled root |
| - | < | + | |
| - | AllowOverride FileInfo AuthConfig Limit Indexes | + | AllowOverride FileInfo AuthConfig Limit Indexes |
| - | Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec | + | Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec |
| - | <Limit GET POST OPTIONS> | + | Require |
| - | Require | + | </ |
| - | </ | + | |
| - | < | + | |
| - | Require all denied | + | |
| - | </ | + | |
| - | </ | + | |
| </ | </ | ||
| Ligne 3393: | Ligne 3351: | ||
| < | < | ||
| - | root@debian8:~# vi / | + | root@debian9:~# vi / |
| - | root@debian8:~# cat / | + | root@debian9:~# cat / |
| < | < | ||
| < | < | ||
| Ligne 3407: | Ligne 3365: | ||
| < | < | ||
| - | root@debian8:~# chmod 711 / | + | root@debian9:~# chmod 711 / |
| - | root@debian8:~# chmod 755 / | + | root@debian9:~# chmod 755 / |
| - | root@debian8:~# chmod 666 / | + | root@debian9:~# chmod 666 / |
| </ | </ | ||
| Ligne 3415: | Ligne 3373: | ||
| < | < | ||
| - | root@debian8:~# lynx --dump http:// | + | root@debian9:~# lynx --dump http:// |
| La Page de l' | La Page de l' | ||
| - | root@debian8:~# | + | root@debian9:~# |
| </ | </ | ||
| Ligne 5124: | Ligne 5082: | ||
| < | < | ||
| [root@centos7 ~]# tail / | [root@centos7 ~]# tail / | ||
| - | 10.0.2.16 - - [02/ | + | 10.0.2.51 - - [02/ |
| - | 10.0.2.16 - - [02/ | + | 10.0.2.51 - - [02/ |
| - | 10.0.2.16 - - [02/ | + | 10.0.2.51 - - [02/ |
| - | 10.0.2.16 - - [02/ | + | 10.0.2.51 - - [02/ |
| - | 10.0.2.16 - - [02/ | + | 10.0.2.51 - - [02/ |
| 127.0.0.1 - jean [02/ | 127.0.0.1 - jean [02/ | ||
| 127.0.0.1 - - [02/ | 127.0.0.1 - - [02/ | ||
| Ligne 5136: | Ligne 5094: | ||
| </ | </ | ||
| - | ====LAB #9 - Gestion du Content Caching avec mod_cache et mod_cache_disk==== | + | ====LAB #9 - Gestion du Web-based Distributed Authoring and Versioning avec mod_dav==== |
| - | + | ||
| - | ====LAB #10 - Gestion d'un Reverse Proxy avec mod_proxy==== | + | |
| - | + | ||
| - | ====LAB #11 - Gestion du Web-based Distributed Authoring and Versioning avec mod_dav==== | + | |
| ===Introduction=== | ===Introduction=== | ||
| Ligne 5297: | Ligne 5251: | ||
| 127.0.0.1 localhost.localdomain localhost | 127.0.0.1 localhost.localdomain localhost | ||
| :: | :: | ||
| - | 10.0.2.16 i2tch.com | + | 10.0.2.51 i2tch.com |
| - | 10.0.2.16 *.i2tch.loc | + | 10.0.2.51 *.i2tch.loc |
| - | 10.0.2.16 www.rhelnom.com | + | 10.0.2.51 www.rhelnom.com |
| 192.168.1.99 | 192.168.1.99 | ||
| - | 10.0.2.16 dav.homeland.net | + | 10.0.2.51 dav.homeland.net |
| </ | </ | ||
| Ligne 5336: | Ligne 5290: | ||
| </ | </ | ||
| - | ==== LAB #12 - Gestion de la réécriture d'URL avec mod_rewrite ==== | + | ==== LAB #10 - Gestion de la réécriture d'URL avec mod_rewrite ==== |
| ===Introduction=== | ===Introduction=== | ||
| Ligne 5868: | Ligne 5822: | ||
| HERE | HERE | ||
| - | ====LAB #13 - Personnalisation des en-têtes de requêtes et de réponses HTTP avec mod_header==== | + | ====LAB #11 - Personnalisation des en-têtes de requêtes et de réponses HTTP avec mod_header==== |
| **HSTS** ou **HTTP Strict Transport Security** est une caractéristique de sécurité qui permet à un site web d' | **HSTS** ou **HTTP Strict Transport Security** est une caractéristique de sécurité qui permet à un site web d' | ||
| Ligne 6016: | Ligne 5970: | ||
| </ | </ | ||
| - | ====LAB #14 - L' | + | ====LAB #12 - L' |
| Le mod_suexec introduit un contrôle plus sévère en ce qui concerne quels comptes peuvent exécuter de CGI. | Le mod_suexec introduit un contrôle plus sévère en ce qui concerne quels comptes peuvent exécuter de CGI. | ||
| Ligne 6206: | Ligne 6160: | ||
| </ | </ | ||
| - | ====LAB #15 - Améliorer l' | + | ====LAB #13 - Améliorer l' |
| Le module MPM worker utilise moins de mémoire que le module prefork pour le même nombre de connexions. | Le module MPM worker utilise moins de mémoire que le module prefork pour le même nombre de connexions. | ||
| Ligne 6370: | Ligne 6324: | ||
| < | < | ||
| <DIV ALIGN=" | <DIV ALIGN=" | ||
| - | Copyright © 2020 Hugh Norris | + | Copyright © 2021 Hugh Norris |
| </ | </ | ||
| </ | </ | ||
| - | |||
| - | |||