Introduction
À la lecture rapide de la documentation de tomcat sur le site d'apache (http://tomcat.apache.org/tomcat-6.0-doc/), voici les idées qui me viennent et les remarques de lecture pour une utilisation un peu plus avancée de ce serveur d'applications.
Encodage
On trouve, dans le fichier $CATALINA_BASE/conf/web.xml
, une directive permettant de définir l'encodage des fichiers :
$CATALINA_BASE/conf/web.xml
diff --git a/web.xml b/web.xml index c2f2b6b..4d4e7db 100644 --- a/web.xml +++ b/web.xml @@ -104,6 +104,10 @@ <param-value>false</param-value> </init-param> <load-on-startup>1</load-on-startup> + <init-param> + <param-name>fileEncoding</param-name> + <param-value>ISO-8859-1</param-value> + </init-param> </servlet>
La valeur par défaut est l'UTF8.
Paramètres pour la production
$CATALINA_BASE/conf/web.xml
diff --git a/web.xml b/web.xml index c2f2b6b..4d4e7db 100644 --- a/web.xml +++ b/web.xml @@ -259,6 +263,18 @@ <param-name>xpoweredBy</param-name> <param-value>false</param-value> </init-param> + <init-param> + <param-name>development</param-name> + <param-value>false</param-value> + </init-param> + <init-param> + <param-name>trimSpaces</param-name> + <param-value>true</param-value> + </init-param> + <init-param> + <param-name>genStrAsCharArray</param-name> + <param-value>true</param-value> + </init-param> <load-on-startup>3</load-on-startup> </servlet>
Faire en sorte que les mots de passes pour l'accès au manager soient cryptés
Réf : http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#Digested_Passwords
À ajouter à $CATALINA_BASE/conf/server.xml
<!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" + digest="SHA" />
Ne plus faire de résolution dns inverse pour la prod
$CATALINA_BASE/conf/server.xml
diff --git a/server.xml b/server.xml index 30673f6..b7a3e04 100644 --- a/server.xml +++ b/server.xml @@ -67,7 +67,8 @@ Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="8080" protocol="HTTP/1.1" - connectionTimeout="20000" + connectionTimeout="20000" + enableLookups="false" redirectPort="8443" /> <!-- A "Connector" using the shared thread pool--> <!-- @@ -87,7 +88,9 @@ --> <!-- Define an AJP 1.3 Connector on port 8009 --> - <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> + <Connector port="8009" protocol="AJP/1.3" + enableLookups="false" + redirectPort="8443"/>