CentOS6 configure tomcat to build a JSP Application Server
First, let's take a look at the differences between jdk and jre:
JDK: an SDK (software development kit) for developers. It provides a development environment and a running environment. Jre is also included.
JRE: for java program users and java Runtime Environment, you only need to run the java program and select JRE.
Of course, JDK is also acceptable. I personally think it is better to run the java program jre and save more resources. The configuration is basically the same as that of JDK.
1. Install jre
tar
zxvf jre-7u17-linux-x64.
tar
.gz
mv
jre-7u17-linux
/usr/local/jre7
# Directly decompress the package and move it to the specified location.
Add Environment Variables
vi/etc/profileJAVA_HOME=/usr/local/jrePATH=$PATH:$JAVA_HOME/binCLASSPATH=.:$JAVA_HOME/lib:dt.jar$JAVA_HOME/lib/tools.jarexportCLASSPATH JAVA_HOME PATHSave and exit!source/etc/profile# Effective environment variablesjava -version# The java version description is displayed successfully.2. install tomcat
Download: http://tomcat.apache.org/download-70.cgi
tarzxvf apache-tomcat-7.0.30.tar.gzmvapache-tomcat-7.0.30/usr/local/tomcat7cd/usr/local/tomcat7/bin/./startup.sh# Start the tomcat program and stop shutdown. sh.Http: // 127.0.0.1: 8080 # The tomcat page is successfully configured.
3. Test the web site
Website ROOT directory:/usr/local/tomcat7/webapps/ROOT
Http: // 127.0.0.1: 8080 # The tomcat page is successfully displayed.
Modify the default tomcat8080 port to 80:
viModify 8080 to 80 in server. xml and restart tomcat:<Connector port="8080"maxThreads="150"minSpareThreads="25"maxSpareThreads="75"enableLookups="false"redirectPort="8443"acceptCount="100"connectionTimeout="20000"disableUploadTimeout="true"/>
View logs: tail-flogs/catalina. out
4. Add multiple web Sites
vi/usr/local/tomcat7/conf/server.xml# Add a host. A host corresponds to a site.<Host name=”www.test. Com "debug =" 0 "appBase =" website program location "unpackWARs ="true” autoDeploy=”true”><alias>test2.com</alias><alias>test2</alias><Context path=”” docBase=”/” debug=”0″ reloadable=”true” /></Host>Restart tomcat!
The http://www.test.com displays the test page. # A host record is required for LAN access by domain name