This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| informatique:linux:alpine:serveur_web [2025/10/28 20:38] – created yahiko | informatique:linux:alpine:serveur_web [2025/10/29 19:52] (current) – yahiko | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Alpine Linux - Installation d'un serveur web ====== | ====== Alpine Linux - Installation d'un serveur web ====== | ||
| - | On va faire simple et un peu sale : Apache2, PHP-FPM | + | <WRAP center round important 60%> |
| + | Cette documentation n'est pas du tout terminée. | ||
| + | </ | ||
| + | |||
| + | |||
| + | On va faire simple et un peu sale : Apache2 | ||
| ===== Documentations ===== | ===== Documentations ===== | ||
| Line 47: | Line 52: | ||
| Créer un fichier de conf Apache. Par exemple : | Créer un fichier de conf Apache. Par exemple : | ||
| - | <code apache> | + | <file apache |
| < | < | ||
| ServerName erreur503.xyz | ServerName erreur503.xyz | ||
| Line 56: | Line 61: | ||
| </ | </ | ||
| </ | </ | ||
| - | </code> | + | </file> |
| Redémarrer Apache2 : | Redémarrer Apache2 : | ||
| Line 63: | Line 68: | ||
| rc-service apache2 restart | rc-service apache2 restart | ||
| </ | </ | ||
| + | |||
| + | ===== PHP ===== | ||
| + | |||
| + | ==== Installer php-fpm ==== | ||
| + | |||
| + | Installer les paquets : | ||
| + | <code bash> | ||
| + | apk add apache2-proxy php php-fpm php-opcache | ||
| + | </ | ||
| + | |||
| + | Activer et démarrer les services : | ||
| + | |||
| + | <code bash> | ||
| + | rc-service php-fpm83 start | ||
| + | rc-update add php-fpm83 | ||
| + | rc-service apache2 restart | ||
| + | </ | ||
| + | |||
| + | ==== Configurer Apache ==== | ||
| + | |||
| + | Dans '' | ||
| + | |||
| + | <code apache> | ||
| + | LoadModule mpm_event_module modules/ | ||
| + | </ | ||
| + | |||
| + | Commenter celle d'en dessous : | ||
| + | |||
| + | <code apache> | ||
| + | #LoadModule mpm_prefork_module modules/ | ||
| + | </ | ||
| + | |||
| + | Cela doit donner quelque chose comme ça : | ||
| + | |||
| + | <code apache> | ||
| + | LoadModule mpm_event_module modules/ | ||
| + | #LoadModule mpm_prefork_module modules/ | ||
| + | </ | ||
| + | |||
| + | Ajouter les lignes suivantes : | ||
| + | |||
| + | <code apache> | ||
| + | < | ||
| + | SetHandler " | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Dans ''/ | ||
| + | |||
| + | <code conf> | ||
| + | user = apache | ||
| + | group = apache | ||
| + | </ | ||
| + | |||
| + | Pour activer PHP au global dans Apache on peut créer un fichier '' | ||
| + | |||
| + | <file apache php83.conf> | ||
| + | < | ||
| + | SetHandler " | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Sinon ce code peut juste être intégrer dans un vhost, du genre : | ||
| + | |||
| + | <file apache test.conf> | ||
| + | < | ||
| + | ServerName erreur503.xyz | ||
| + | DocumentRoot / | ||
| + | < | ||
| + | SetHandler " | ||
| + | </ | ||
| + | < | ||
| + | AllowOverride All | ||
| + | Require all granted | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ==== Vérification du fonctionnement ==== | ||
| + | On peut vérifier en créant un fichier '' | ||
| + | |||
| + | <file php phpinfo.php> | ||
| + | <?php phpinfo(); ?> | ||
| + | </ | ||