Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| elearning:workbooks:tomcat:tc03 [2020/11/02 16:54] – admin | elearning:workbooks:tomcat:tc03 [2023/12/05 09:11] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| ~~PDF: | ~~PDF: | ||
| + | |||
| + | Version : **2023.01**. | ||
| Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
| - | ======SER303 - Configuration du serveur Tomcat | + | ======SER303 - Configuration du serveur Tomcat====== |
| =====Contenu du Module===== | =====Contenu du Module===== | ||
| - | * **SER303 - Configuration du serveur Tomcat | + | * **SER303 - Configuration du serveur Tomcat** |
| * Contenu du Module | * Contenu du Module | ||
| * Architecture du Serveur | * Architecture du Serveur | ||
| Ligne 462: | Ligne 464: | ||
| <note warning> | <note warning> | ||
| - | Afin d' | + | **Attention** - Afin d' |
| </ | </ | ||
| Ligne 535: | Ligne 537: | ||
| | deployOnStartup | Spécifie si les applications sont déployées automatiquement lors du démarrage du serveur | true | true | | | deployOnStartup | Spécifie si les applications sont déployées automatiquement lors du démarrage du serveur | true | true | | ||
| | unpackWars | Spécifie si les archives compressées au format .war doivent être décompressées automatiquement | true | true | | | unpackWars | Spécifie si les archives compressées au format .war doivent être décompressées automatiquement | true | true | | ||
| - | | deployXML | Spécifie que le déploiement des applications peut être autoorg.apache.catalina.realm.DataSourceRealmrisé | + | | deployXML | Spécifie que le déploiement des applications peut être autorisé |
| | workDir | Spécifie le répertoire de travail de l' | | workDir | Spécifie le répertoire de travail de l' | ||
| Ligne 773: | Ligne 775: | ||
| | resolveHosts | Transforme les adresse IP en nom d' | | resolveHosts | Transforme les adresse IP en nom d' | ||
| | fileDateFormat | Spécifie le format de date utilisé pour nommé le fichier | - | yyyy_MM_dd | | fileDateFormat | Spécifie le format de date utilisé pour nommé le fichier | - | yyyy_MM_dd | ||
| + | |||
| + | Voici le fichier **server.xml** au complet : | ||
| + | |||
| + | < | ||
| + | <?xml version=' | ||
| + | <!-- | ||
| + | Licensed to the Apache Software Foundation (ASF) under one or more | ||
| + | contributor license agreements. | ||
| + | this work for additional information regarding copyright ownership. | ||
| + | The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| + | (the " | ||
| + | the License. | ||
| + | |||
| + | http:// | ||
| + | |||
| + | Unless required by applicable law or agreed to in writing, software | ||
| + | distributed under the License is distributed on an "AS IS" BASIS, | ||
| + | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| + | See the License for the specific language governing permissions and | ||
| + | limitations under the License. | ||
| + | --> | ||
| + | <!-- Note: A " | ||
| + | | ||
| + | | ||
| + | | ||
| + | <Server port=" | ||
| + | < | ||
| + | <!-- Security listener. Documentation at / | ||
| + | < | ||
| + | --> | ||
| + | <!--APR library loader. Documentation at / | ||
| + | < | ||
| + | <!-- Prevent memory leaks due to use of particular java/javax APIs--> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | <!-- Global JNDI resources | ||
| + | | ||
| + | --> | ||
| + | < | ||
| + | <!-- Editable user database that can also be used by | ||
| + | | ||
| + | --> | ||
| + | < | ||
| + | type=" | ||
| + | description=" | ||
| + | factory=" | ||
| + | pathname=" | ||
| + | </ | ||
| + | |||
| + | <!-- A " | ||
| + | a single " | ||
| + | so you may not define subcomponents such as " | ||
| + | | ||
| + | | ||
| + | <Service name=" | ||
| + | |||
| + | <!--The connectors can use a shared executor, you can define one or more named thread pools--> | ||
| + | <!-- | ||
| + | < | ||
| + | maxThreads=" | ||
| + | --> | ||
| + | |||
| + | |||
| + | <!-- A " | ||
| + | and responses are returned. Documentation at : | ||
| + | Java HTTP Connector: / | ||
| + | Java AJP Connector: / | ||
| + | APR (HTTP/AJP) Connector: / | ||
| + | | ||
| + | --> | ||
| + | < | ||
| + | | ||
| + | | ||
| + | <!-- A " | ||
| + | <!-- | ||
| + | < | ||
| + | | ||
| + | | ||
| + | | ||
| + | --> | ||
| + | <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 | ||
| + | This connector uses the NIO implementation that requires the JSSE | ||
| + | style configuration. When using the APR/native implementation, | ||
| + | | ||
| + | | ||
| + | <!-- | ||
| + | < | ||
| + | | ||
| + | | ||
| + | --> | ||
| + | |||
| + | <!-- Define an AJP 1.3 Connector on port 8009 --> | ||
| + | < | ||
| + | |||
| + | |||
| + | <!-- An Engine represents the entry point (within Catalina) that processes | ||
| + | every request. | ||
| + | | ||
| + | on to the appropriate Host (virtual host). | ||
| + | | ||
| + | |||
| + | <!-- You should set jvmRoute to support load-balancing via AJP ie : | ||
| + | <Engine name=" | ||
| + | --> | ||
| + | <Engine name=" | ||
| + | |||
| + | <!--For clustering, please take a look at documentation at: | ||
| + | / | ||
| + | / | ||
| + | <!-- | ||
| + | <Cluster className=" | ||
| + | --> | ||
| + | |||
| + | <!-- Use the LockOutRealm to prevent attempts to guess user passwords | ||
| + | via a brute-force attack --> | ||
| + | <Realm className=" | ||
| + | <!-- This Realm uses the UserDatabase configured in the global JNDI | ||
| + | | ||
| + | that are performed against this UserDatabase are immediately | ||
| + | | ||
| + | <Realm className=" | ||
| + | | ||
| + | </ | ||
| + | |||
| + | <Host name=" | ||
| + | unpackWARs=" | ||
| + | |||
| + | <!-- SingleSignOn valve, share authentication between web applications | ||
| + | | ||
| + | <!-- | ||
| + | <Valve className=" | ||
| + | --> | ||
| + | <Valve className=" | ||
| + | directory=" | ||
| + | resolveHosts=" | ||
| + | pattern=" | ||
| + | <!-- Access log processes all example | ||
| + | | ||
| + | Note: The pattern used is equivalent to using pattern=" | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| Dans ce cas, le fichier généré sera nommé **tomcat_access.yyyy_MM_dd.txt**. | Dans ce cas, le fichier généré sera nommé **tomcat_access.yyyy_MM_dd.txt**. | ||
| Ligne 842: | Ligne 991: | ||
| < | < | ||
| [root@centos7 bin]# cat / | [root@centos7 bin]# cat / | ||
| - | [29/ | + | [29/ |
| </ | </ | ||
| Ligne 854: | Ligne 1003: | ||
| < | < | ||
| - | CREATE DATABASE `tomcat`; | ||
| USE `tomcat`; | USE `tomcat`; | ||
| CREATE TABLE `tomcat`.`AccessLog` ( | CREATE TABLE `tomcat`.`AccessLog` ( | ||
| Ligne 877: | Ligne 1025: | ||
| [root@centos7 bin]# vi tomcat.sql | [root@centos7 bin]# vi tomcat.sql | ||
| [root@centos7 bin]# cat tomcat.sql | [root@centos7 bin]# cat tomcat.sql | ||
| - | CREATE DATABASE `tomcat`; | ||
| USE `tomcat`; | USE `tomcat`; | ||
| CREATE TABLE `tomcat`.`AccessLog` ( | CREATE TABLE `tomcat`.`AccessLog` ( | ||
| Ligne 895: | Ligne 1042: | ||
| </ | </ | ||
| - | Ce fichier contient les commandes SQL nécessaires pour créer la base de données MariaDB | + | Ce fichier contient les commandes SQL nécessaires pour créer la table **AccessLog** |
| + | |||
| + | Créez donc la base de données **tomcat** : | ||
| + | |||
| + | < | ||
| + | [root@centos7 bin]# mysql -u root -p | ||
| + | Enter password: | ||
| + | Welcome to the MariaDB monitor. | ||
| + | Your MariaDB connection id is 6 | ||
| + | Server version: 5.5.64-MariaDB MariaDB Server | ||
| + | |||
| + | Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. | ||
| + | |||
| + | Type ' | ||
| + | |||
| + | MariaDB [(none)]> | ||
| + | ... | ||
| + | MariaDB [(none)]> | ||
| + | </ | ||
| + | |||
| + | Injectez donc les commandes SQL dans MariaDB : | ||
| < | < | ||
| Ligne 961: | Ligne 1128: | ||
| < | < | ||
| [root@centos7 bin]# wget http:// | [root@centos7 bin]# wget http:// | ||
| - | </ | ||
| - | |||
| - | ou | ||
| - | |||
| - | < | ||
| - | [root@centos7 bin]# wget https:// | ||
| </ | </ | ||
| Ligne 1055: | Ligne 1216: | ||
| | id | remoteHost | userName | timestamp | | id | remoteHost | userName | timestamp | ||
| +----+------------+----------+---------------------+-------------+--------+--------+--------+-------+---------+-----------+ | +----+------------+----------+---------------------+-------------+--------+--------+--------+-------+---------+-----------+ | ||
| - | | 1 | 10.0.2.15 | NULL | 2019-10-29 13:18:29 | | + | | 1 | 10.0.2.51 | NULL | 2019-10-29 13:18:29 | |
| +----+------------+----------+---------------------+-------------+--------+--------+--------+-------+---------+-----------+ | +----+------------+----------+---------------------+-------------+--------+--------+--------+-------+---------+-----------+ | ||
| 1 row in set (0.00 sec) | 1 row in set (0.00 sec) | ||
| Ligne 1062: | Ligne 1223: | ||
| Bye | Bye | ||
| </ | </ | ||
| + | |||
| ===L' | ===L' | ||
| Ligne 1619: | Ligne 1781: | ||
| ----- | ----- | ||
| - | < | + | Copyright © 2023 Hugh Norris. |
| - | <div align=" | + | |
| - | Copyright © 2020 Hugh Norris. | + | |
| - | </ | + | |
| - | </ | + | |