On passe en Stretch par défaut
This commit is contained in:
parent
9534a3143c
commit
0ac9e25761
124
HowtoApache.md
124
HowtoApache.md
|
@ -13,14 +13,14 @@ title: Howto Apache
|
|||
Nous utilisons la version [Apache-ITK](http://mpm-itk.sesse.net/) depuis des années en production sur de nombreux serveurs critiques. Apache-ITK permet de préciser pour chaque VirtualHost un utilisateur, un groupe et une option *MaxClients* spécifiques, ce qui est utile pour la sécurité d'un serveur multi-sites.
|
||||
|
||||
~~~
|
||||
# apt install apache2-mpm-itk libapache2-mod-evasive apachetop libwww-perl
|
||||
# apt install apache2 libapache2-mpm-itk libapache2-mod-evasive apachetop libwww-perl
|
||||
|
||||
# apache2ctl -V
|
||||
Server version: Apache/2.4.10 (Debian)
|
||||
Server built: Sep 15 2016 20:44:43
|
||||
Server's Module Magic Number: 20120211:37
|
||||
Server loaded: APR 1.5.1, APR-UTIL 1.5.4
|
||||
Compiled using: APR 1.5.1, APR-UTIL 1.5.4
|
||||
Server version: Apache/2.4.25 (Debian)
|
||||
Server built: 2017-07-18T18:37:33
|
||||
Server's Module Magic Number: 20120211:68
|
||||
Server loaded: APR 1.5.2, APR-UTIL 1.5.4
|
||||
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
|
||||
Architecture: 64-bit
|
||||
Server MPM: prefork
|
||||
threaded: no
|
||||
|
@ -44,31 +44,43 @@ Server compiled with....
|
|||
-D SERVER_CONFIG_FILE="apache2.conf"
|
||||
~~~
|
||||
|
||||
> *Note* : Pour Debian 8, il faut installer ainsi :
|
||||
>
|
||||
> ~~~
|
||||
> # apt install apache2-mpm-itk libapache2-mod-evasive apachetop libwww-perl
|
||||
> ~~~
|
||||
|
||||
|
||||
## Configuration de base
|
||||
|
||||
Fichiers de configuration :
|
||||
|
||||
/etc/apache2/
|
||||
├── apache2.conf
|
||||
├── conf-available
|
||||
│ └── *.conf
|
||||
├── conf-enabled
|
||||
│ └── *.conf -> ../conf-available/*.conf
|
||||
├── envvars
|
||||
├── magic
|
||||
├── mods-available
|
||||
│ ├── *.conf
|
||||
│ └── *.load
|
||||
├── mods-enabled
|
||||
│ ├── *.conf -> ../mods-available/*.conf
|
||||
│ └── *.load -> ../mods-available/*.load
|
||||
├── ports.conf
|
||||
├── sites-available
|
||||
│ └── *.conf
|
||||
└── sites-enabled
|
||||
└── *.conf -> ../sites-available/*.conf
|
||||
~~~
|
||||
/etc/apache2
|
||||
├── apache2.conf
|
||||
├── conf-available
|
||||
│ └── X.conf
|
||||
├── conf-enabled
|
||||
│ └── X.conf -> ../conf-available/X.conf
|
||||
├── envvars
|
||||
├── magic
|
||||
├── mods-available
|
||||
│ ├── X.load
|
||||
│ └── X.conf
|
||||
├── mods-enabled
|
||||
│ ├── X.load -> ../mods-available/X.load
|
||||
│ └── X.conf -> ../mods-available/X.conf
|
||||
├── ports.conf
|
||||
├── sites-available
|
||||
│ ├── 000-default.conf
|
||||
│ ├── default-ssl.conf
|
||||
│ └── X.conf
|
||||
└── sites-enabled
|
||||
│ ├── 000-default.conf -> ../sites-available/000-default.conf
|
||||
└── X.conf -> ../sites-available/X.conf
|
||||
~~~
|
||||
|
||||
Nous activons toujours les modules suivants :
|
||||
Nous activons toujours au minimum les modules suivants :
|
||||
|
||||
~~~
|
||||
# a2enmod rewrite expires headers rewrite cgi
|
||||
|
@ -91,6 +103,8 @@ MaxRequestsPerChild 100
|
|||
<Directory /home/>
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
# "Require not env XXX" is not supported :(
|
||||
Deny from env=GoAway
|
||||
</Directory>
|
||||
<IfModule mod_ssl.c>
|
||||
SSLProtocol all -SSLv2 -SSLv3
|
||||
|
@ -333,6 +347,58 @@ Le module [xsendfile](https://tn123.org/mod_xsendfile/) permet de rediriger l'en
|
|||
|
||||
Pour autoriser son utilisation via *.htaccess*, on ajoute `Options` à `AllowOverride`.
|
||||
|
||||
### mod_negotiation
|
||||
|
||||
Le module [negotiation](https://httpd.apache.org/docs/2.4/mod/mod_negotiation.html) permet de servir des documents en fonction de critère, notamment la langue acceptée par le client HTTP.
|
||||
|
||||
~~~
|
||||
# a2enmod negotiation include alias
|
||||
~~~
|
||||
|
||||
Vous pouvez éditer le fichier `/etc/apache2/conf-enabled/localized-error-pages.conf` qui permet d'afficher des pages d'erreur en différentes langues, et décommenter cette partie :
|
||||
|
||||
Exemple avec un service HTTP local :
|
||||
|
||||
~~~{.apache}
|
||||
<IfModule mod_negotiation.c>
|
||||
<IfModule mod_include.c>
|
||||
<IfModule mod_alias.c>
|
||||
|
||||
Alias /error/ "/usr/share/apache2/error/"
|
||||
|
||||
<Directory "/usr/share/apache2/error">
|
||||
Options IncludesNoExec
|
||||
AddOutputFilter Includes html
|
||||
AddHandler type-map var
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
LanguagePriority en cs de es fr it nl sv pt-br ro
|
||||
ForceLanguagePriority Prefer Fallback
|
||||
</Directory>
|
||||
|
||||
ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
|
||||
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
|
||||
ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
|
||||
ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
|
||||
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
|
||||
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
|
||||
ErrorDocument 410 /error/HTTP_GONE.html.var
|
||||
ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
|
||||
ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
|
||||
ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
|
||||
ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
|
||||
ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
|
||||
ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
|
||||
ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
|
||||
ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
|
||||
ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
|
||||
ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
~~~
|
||||
|
||||
|
||||
## Authentification HTTP
|
||||
|
||||
### HTTP Basic Authentication (mod_auth_basic)
|
||||
|
@ -440,7 +506,7 @@ Attention, pour certains sites avec de nombreuses ressources statiques sur le m
|
|||
|
||||
[Fail2Ban](HowtoFail2Ban) est indépendant d'Apache, mais peut être utilisé pour de la détection plus précise que *mod_evasive* : il va lire en permanence les journaux générés par Apache (ce qui peut être coûteux en ressources) et il pourra bannir des adresses IP si cela répond à certaines règles comme trop de connexions à une page d'authentification par exemple.
|
||||
|
||||
<http://trac.evolix.net/infogerance/wiki/HowtoFail2Ban#ApacheNginxDDOS>
|
||||
Voir <https://wiki.evolix.org/HowtoFail2Ban#apache-nginx>
|
||||
|
||||
### ModSecurity
|
||||
|
||||
|
@ -493,7 +559,7 @@ Pour une configuration avancée, on ajuste l'utilisation du jeu de règles *mods
|
|||
|
||||
[AWStats](http://www.awstats.org/) est un outil pour générer des statistiques en fonction d'un fichier de logs.
|
||||
|
||||
Voir http://trac.evolix.net/infogerance/wiki/HowtoLAMP/AwStats
|
||||
Voir <https://wiki.evolix.org/HowtoLAMP/AwStats>
|
||||
|
||||
*Note :* une configuration AWStats peut être forcée au sein d'un VirtualHost grâce à la directive `SetEnv AWSTATS_FORCE_CONFIG example`
|
||||
|
||||
|
@ -501,7 +567,7 @@ Voir http://trac.evolix.net/infogerance/wiki/HowtoLAMP/AwStats
|
|||
|
||||
### log2mail
|
||||
|
||||
Pour être alerté en cas de *Segmentation fault*, on ajoute la configuration suivante au logiciel [log2mail](http://trac.evolix.net/infogerance/wiki/HowtoLog2mail) :
|
||||
Pour être alerté en cas de *Segmentation fault*, on ajoute la configuration suivante au logiciel [log2mail](https://wiki.evolix.org/HowtoLog2mail) :
|
||||
|
||||
~~~
|
||||
file = /var/log/apache2/error.log
|
||||
|
|
Loading…
Reference in New Issue