We shall consider Apache Tomcat has been installed to "Apache-Tomcat/" and here we are looking to configure it.
Tomcat Configuration #1: Where is the server.xml file?
Server.xml file can be found under the conf directory,
Tomcat Configuration #2: Where is the setenv file, or setenv.sh?
setenv file can be found under the bin directory,
Tomcat Configuration #3: How to set JAVA_OPTS?
JAVA_OPTS should be entered in setenv.sh file, find the bash variable JAVA_OPTS then, then you can append your options to this shell variable, as shown below
Tomcat Configuration #4: How to start tomcat?
Apache Tomcat can be started from the bin directory, invoking the startup script ./catalina.sh start
Tomcat Configuration #5: How to Stop tomcat?
To stop Tomcat, go to bin directory, invoke the startup script ./catalina.sh stop
Tomcat Configuration #6: How to check if tomcat instance is running
From the Linux command line, the process can be checked as follows,
Where the word must be something exact match to your tomcat instance directory name
ps -ef | grep tomcat
You can also list all Java process by the following command
ps -ef | grep java
Tomcat Configuration #7: What is tomcat log file location?
All Tomcat logs are stored under Tomcat/logs directory,
Tomcat Configuration #8: How to cleanup tomcat instance completely without deleting tomcat
WARNING: This should be done with care, this will delete all your applications and related data (not the database)if any.
Deleting all web applications
#1: Stop tomcat instance.
#2: Delete your apps from webapps directory,
#3: Delete everything under logs directory
#4: Delete everything under work directory
#5: Delete everything under temp directory
# Example deleting webapps contents
rm -rf Apache-Tomcat/webapps/your-app11
rm -rf Apache-Tomcat/webapps/your-app22
Tomcat Configuration #9: How to force stop tomcat instance
Note: This is NOT recommended in a production environment since this will abruptly stop the running application and may corrupt the data!
If in case, the tomcat service is unable to stop by invoking catalina.sh stop, then the tomcat process can be stopped by stopping the process ID(PID).
#1: get the process ID:
Note: if multiple tomcats are running, get the correct PID to stop
ps -ef | grep tomcat
#2: Stop the PID using the kill command
kill -9 PID
Tomcat Configuration #10: Where to get the latest version of Apache-Tomcat?
The latest version of Apache Tomcat can be obtained from the official project website: http://tomcat.apache.org/