tech:notes_apache
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_apache [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:notes_apache [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes apache | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | Version | ||
| + | apachectl -v | ||
| + | |||
| + | Server MPM Mode | ||
| + | apachectl -V | ||
| + | |||
| + | Loaded Modules | ||
| + | apachectl -M | ||
| + | |||
| + | Compiled in modules | ||
| + | apachectl -l | ||
| + | |||
| + | Test Syntax | ||
| + | apachectl -t | ||
| + | |||
| + | Liste des vhosts | ||
| + | apache2ctl -S | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Contexte variable environnent Apache. | ||
| + | ~~~bash | ||
| + | grep -Pa -o ' | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Rewrite | ||
| + | |||
| + | Exemple de conf | ||
| + | ~~~apache | ||
| + | RewriteCond %{HTTP_HOST} =plop.acme.fr [NC,OR] | ||
| + | RewriteCond %{HTTP_HOST} =www.plop.acme.fr [NC] | ||
| + | RewriteRule .* https:// | ||
| + | |||
| + | |||
| + | ### GARBAGE COLLECTOR ### | ||
| + | RewriteRule .* https:// | ||
| + | ~~~ | ||
| + | |||
| + | ## Perf | ||
| + | |||
| + | Voir : | ||
| + | * < | ||
| + | |||
| + | Mem par process | ||
| + | ~~~bash | ||
| + | ps -ylC httpd --sort: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ## check allow and deny rules | ||
| + | |||
| + | 2.2 configuration: | ||
| + | |||
| + | ~~~ | ||
| + | Order allow,deny | ||
| + | Allow from all | ||
| + | ~~~ | ||
| + | |||
| + | 2.4 configuration: | ||
| + | |||
| + | ~~~ | ||
| + | Require all granted | ||
| + | # Require all denied | ||
| + | ~~~ | ||
| + | |||
| + | ## Hardening Apache | ||
| + | |||
| + | Liens : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | ## Ignorer dans les logs File does not exist: / | ||
| + | |||
| + | `/ | ||
| + | ~~~apache | ||
| + | Redirect 404 / | ||
| + | < | ||
| + | ErrorDocument 404 "No favicon" | ||
| + | </ | ||
| + | ~~~ | ||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | |||
| + | ## Pb | ||
| + | |||
| + | ### Erreur FastCGI: comm with server - FastCGI: incomplete headers | ||
| + | |||
| + | ~~~ | ||
| + | 2017-06-16T10: | ||
| + | 2017-06-16T10: | ||
| + | ~~~ | ||
| + | |||
| + | Si on n'y regarde de plus prêt, on voit dans le access.log, avant l' | ||
| + | ~~~ | ||
| + | 2017-06-16T10: | ||
| + | ~~~ | ||
| + | |||
| + | Le pb vient que le script PHP / | ||
| + | On constate que si la durée est inférieur à 30 secondes, c'est OK => ( 200 ). Si plus de 30s => erreur ( 500 ) | ||
| + | |||
| + | ~~~bash | ||
| + | grep plop.php / | ||
| + | ~~~ | ||
| + | ~~~ | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### [warn] _default_ VirtualHost overlap on port 443, the first has precedence | ||
| + | |||
| + | ~~~ | ||
| + | # apachectl -t | ||
| + | [Mon Sep 14 14:31:10 2020] [warn] _default_ VirtualHost overlap on port 443, the first has precedence | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Solution | ||
| + | |||
| + | Ajouter `NameVirtualHost *:443` | ||
| + | |||
| + | `/ | ||
| + | ~~~apache | ||
| + | < | ||
| + | NameVirtualHost *:443 | ||
| + | # If you add NameVirtualHost *:443 here, you will also have to change | ||
| + | # the VirtualHost statement in / | ||
| + | # to < | ||
| + | # Server Name Indication for SSL named virtual hosts is currently not | ||
| + | # supported by MSIE on Windows XP. | ||
| + | Listen 443 | ||
| + | </ | ||
| + | ~~~ | ||
| + | |||
