November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Disable HTTP Methods in Tomcat

HOWTO: Disable HTTP Methods in Tomcat Introduction

In the Apache web server, if you want to disable access to specific methods, you can take advantage of mod_rewrite and disable just about anything, often with only one or two lines of configuration file entries. In Apache Tomcat, security is enforced by way of security constraints that […]

How to hide web server version in Tomcat

Add the following attributes to the <Connector> in Tomcat’s server.xml to hide web server version in Tomcat at line no- 73 :-

# vim apache-tomcat/conf/server.xml

<Connector port=”8080? protocol=”HTTP/1.1?connectionTimeout=”20000?redirectPort=”8443?server=”Tomcat” />

Tomcat stop start script for redhat

#Startup script for Tomcat JAVA_HOME=/usr/java/jdk1.6.0_43 export JAVA_HOME start_tomcat=/opt/tomcat6/bin/startup.sh stop_tomcat=/opt/tomcat6/bin/shutdown.sh

start() { echo -n “Starting tomcat:” su -c ${start_tomcat} – tomcat echo “done.” } stop() { echo -n “Shutting down tomcat: “ ${stop_tomcat} echo “done.” }

# See how we were called case “$1” in start) start ;; stop) stop ;; restart) stop sleep 10 start […]

Java Heap Dump and analyze

First get the Java Applications Process Id, one way to do this is with: jps

jmap -dump:format=b,file=dump.bin <javaProcessIdHere>

The size of the heap dump file will be same as the heap memory in use at the time the command is run. For large heap sizes this can take several minutes to run, and can stall […]

Convert an OpenSSL (Apache) SSL Certificate to a PKCS12 (Tomcat)

Convert the Key to a PKCS12 Key. This will prompt you for a password which you will need when you change the Tomcat configuration.

openssl pkcs12 -export -in /etc/apache2/ssl.crt/somedomain.com.crt -out somedomain.com.pkcs12 -name “somedomain.com” -inkey /etc/apache2/ssl.key/somedomain.com.com.key

Verify that the pkcs12 file contains your key. You should be able to see your certificate’s common name, and various […]

Enable SSL in Tomcat

Step 1 Windows[goto Command] %JAVA_HOME%\bin\keytool -genkey

Enter all the details which keytool is going to prompt. (rememeber the password)

once you done, please go to your [USER_HOME](document & settings), locate the .keystore.

Copy this file and paste in tomcat root folder.

Step 2 Open [tomcat_home]/conf/server.xml

uncomment the SSL config entry. And configure the SSL certificate […]

TOMCAT TUNING

tuning rules Doesn’t compensate for bad, slow or poorly written applications If you allocate memory more than 3g, preferably divided into multiple tomcat young generation can not be set too much, minor gc will stop the world.

Three factors negatively impact Tomcat’s performance more than any others – network delays, remote client latency, and […]

21 Apache Tomcat Configuration Tips

Tip #1 – Watch Out for White Space

When installing Tomcat under Windows, the path to the installation directory should not contain white space. The default (c:/Program Files) is not acceptable, because it contains a white space character. Installing under “C:/ProgramFiles” is acceptable because this path does not contain any white space characters.

Tip #2 […]

Enable gzip compression in tomcat

Apache tomcat will support gzip compression. The advantage of compression is the output response will be compressed 6 to 10 times.

To enable gzip compression you need to add some additional properties in $APACHE_TOMCAT_HOME_HOME/conf/server.xml file.

Open conf/server.xml from your tomcat home directory with any text editor.

Search for “Connector port=”8080?”, line at this content will […]

Tomcat 6 Access Logging

One of tomcat’s strength is in it’s logging but one of the logger types disabled by default from the base configuration is one that adds access logging support into tomcat. This provides you with a view of activity that you may find useful for debugging, troubleshooting, usage analysis, etc. Enabling it is simply a matter […]