« Apache » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 1 : | Ligne 1 : | ||
= <span style="color:# | = <span style="color:#7e5109;">Apache HTTPD</span> = | ||
{| style="width:100%; background:# | {| style="width:100%; background:#fef5e7; border:1px solid #f5cba7; padding:15px; border-radius:10px; overflow:hidden;" | ||
| | | | ||
<span style="font-size: | <span style="font-size:120%; color:#7e5109;"> | ||
Le <b>serveur Apache HTTPD</b> permet d’héberger des sites web et de fournir des services HTTP et HTTPS au sein de l’infrastructure. | |||
</span> | </span> | ||
|} | |} | ||
== <span style="color:# | = <span style="color:#7e5109;">Infrastructure Web — Apache HTTPD</span> = | ||
{| style="width:100%; background:#fdf2e9; border:1px solid #edbb99; padding:15px; border-radius:10px; overflow:hidden;" | |||
| | |||
<span style="font-size:115%; color:#935116;"> | |||
<b>Documentation complète d’installation et de configuration d’un serveur web Apache avec SSL</b> | |||
</span> | |||
|} | |||
__TOC__ | |||
= <span style="color:#af601a;">1 — Installation et Configuration Apache HTTPD</span> = | |||
{| style="width:100%; background:#fef9e7; border:1px solid #f7dc6f; padding:12px; border-radius:10px; overflow:hidden;" | |||
| | |||
<b style="color:#af601a;">Installation et configuration du serveur web Apache</b> | |||
|} | |||
== <span style="color:#ca6f1e;">Installation des packages</span> == | |||
<pre> | <pre> | ||
| Ligne 14 : | Ligne 32 : | ||
</pre> | </pre> | ||
== <span style="color:# | == <span style="color:#ca6f1e;">Configuration du serveur</span> == | ||
Modifier le nom de la machine et l’adresse d’écoute dans : | |||
<pre> | |||
vi /etc/httpd/conf/httpd.conf | |||
</pre> | |||
Modifier les lignes : | |||
<pre> | <pre> | ||
| Ligne 24 : | Ligne 47 : | ||
</pre> | </pre> | ||
Configuration attendue : | |||
<pre> | <pre> | ||
| Ligne 33 : | Ligne 54 : | ||
</pre> | </pre> | ||
== <span style="color:# | ---- | ||
= <span style="color:#a04000;">2 — Gestion du service HTTPD</span> = | |||
{| style="width:100%; background:#fbeee6; border:1px solid #edbb99; padding:12px; border-radius:10px; overflow:hidden;" | |||
| | |||
<b style="color:#a04000;">Démarrage et vérification du service</b> | |||
|} | |||
== <span style="color:#ba4a00;">Démarrage du service</span> == | |||
<pre> | <pre> | ||
| Ligne 40 : | Ligne 70 : | ||
</pre> | </pre> | ||
== <span style="color:# | == <span style="color:#ba4a00;">Vérification du service</span> == | ||
<pre> | <pre> | ||
| Ligne 46 : | Ligne 76 : | ||
</pre> | </pre> | ||
Si le service fonctionne correctement, | Si le service fonctionne correctement, deux ports doivent être en écoute : 80 et 443. | ||
---- | |||
< | = <span style="color:#884ea0;">3 — Ouverture des ports Firewall</span> = | ||
</ | |||
= | {| style="width:100%; background:#f5eef8; border:1px solid #d7bde2; padding:12px; border-radius:10px; overflow:hidden;" | ||
| | |||
<b style="color:#884ea0;">Configuration des règles iptables</b> | |||
|} | |||
== <span style="color:#9b59b6;">Configuration</span> == | |||
<pre> | <pre> | ||
| Ligne 61 : | Ligne 93 : | ||
-I INPUT 2 -p tcp --dport 80 -j ACCEPT | -I INPUT 2 -p tcp --dport 80 -j ACCEPT | ||
-I INPUT 3 -p tcp --dport 443 -j ACCEPT | -I INPUT 3 -p tcp --dport 443 -j ACCEPT | ||
</pre> | |||
Enregistrer : | |||
<pre> | |||
systemctl reload iptables | systemctl reload iptables | ||
</pre> | </pre> | ||
Vérification | == <span style="color:#9b59b6;">Vérification</span> == | ||
<pre> | <pre> | ||
| Ligne 70 : | Ligne 107 : | ||
</pre> | </pre> | ||
== <span style="color:# | == <span style="color:#9b59b6;">Résultat attendu</span> == | ||
<pre> | <pre> | ||
| Ligne 82 : | Ligne 119 : | ||
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 | 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 | ||
0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited | 0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited | ||
</pre> | |||
---- | |||
= <span style="color:#196f3d;">4 — Création du site web</span> = | |||
= | {| style="width:100%; background:#eafaf1; border:1px solid #a9dfbf; padding:12px; border-radius:10px; overflow:hidden;" | ||
| | |||
<b style="color:#196f3d;">Création et permissions du site</b> | |||
|} | |||
== <span style="color:#239b56;">Création de la page d’accueil</span> == | |||
<pre> | <pre> | ||
| Ligne 100 : | Ligne 136 : | ||
</pre> | </pre> | ||
Exemple | Exemple : | ||
<pre> | <pre> | ||
| Ligne 106 : | Ligne 142 : | ||
</pre> | </pre> | ||
== <span style="color:#239b56;">Droits d’accès</span> == | |||
<pre> | <pre> | ||
| Ligne 112 : | Ligne 148 : | ||
</pre> | </pre> | ||
== <span style="color:#239b56;"> | == <span style="color:#239b56;">Vérification</span> == | ||
Tester avec | Tester avec curl : | ||
<pre> | <pre> | ||
| Ligne 120 : | Ligne 156 : | ||
</pre> | </pre> | ||
Vous | Vous devez voir le contenu de votre page web. | ||
Répéter la procédure sur | Répéter la procédure sur le second serveur si nécessaire. | ||
---- | |||
{| style="width:100%; background:#e8f8f5; border:1px solid #a3e4d7; padding:15px; border-radius:10px; overflow:hidden;" | |||
| | |||
<span style="font-size:120%; color:#117864;"> | |||
<b>Serveur Apache HTTPD opérationnel</b> | |||
</span> | |||
|} | |||
Version du 17 février 2026 à 13:57
Apache HTTPD
Infrastructure Web — Apache HTTPD
1 — Installation et Configuration Apache HTTPD
Installation des packages
dnf install httpd mod_ssl -y
Configuration du serveur
Modifier le nom de la machine et l’adresse d’écoute dans :
vi /etc/httpd/conf/httpd.conf
Modifier les lignes :
Listen 80 #ServerName www.example.com:80
Configuration attendue :
Listen *:80 ServerName web:80
2 — Gestion du service HTTPD
Démarrage du service
systemctl start httpd.service --now systemctl enable httpd.service --now
Vérification du service
ss -atnp | grep httpd
Si le service fonctionne correctement, deux ports doivent être en écoute : 80 et 443.
3 — Ouverture des ports Firewall
Configuration
vi /etc/sysconfig/iptables -I INPUT 2 -p tcp --dport 80 -j ACCEPT -I INPUT 3 -p tcp --dport 443 -j ACCEPT
Enregistrer :
systemctl reload iptables
Vérification
iptables -nvL
Résultat attendu
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
81 5840 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
<span style="background-color:#fff3cd;"> 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80</span>
<span style="background-color:#fff3cd;"> 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443</span>
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
4 — Création du site web
Création de la page d’accueil
vi /var/www/html/index.html
Exemple :
cc
Droits d’accès
chown apache.apache -R /var/www/html
Vérification
Tester avec curl :
curl 192.168.10.251
Vous devez voir le contenu de votre page web. Répéter la procédure sur le second serveur si nécessaire.