阿里云安装Tomcat
tar -zxvf apache-tomcat-8.0.35.tar.gz -C /usr/local/src/
5、设置tomcat开机自启动,编辑/usr/local/src/apache-tomcat-8.0.35.tar.gz/bin/startup.sh
# vim /usr/local/src/apache-tomcat-8.0.35/bin/startup.sh
加入如下行:
#chkconfig: 2345 80 90
#description:tomcat auto start
#processname: tomcat
6、编辑/usr/local/src/apache-tomcat-8.0.35/bin/catalina.sh
# vim /usr/local/src/apache-tomcat-8.0.35/bin/catalina.sh
export CATALINA_BASE=/usr/local/src/apache-tomcat-8.0.35
export CATALINA_HOME=/usr/local/src/apache-tomcat-8.0.35
export CATALINA_TMPDIR=/usr/local/src/apache-tomcat-8.0.35
7、将tomcat加入开机自启动
# vi /etc/rc.d/rc.local
加入如下内容:
export JAVA_HOME=/usr/local/jdk1.7.0_79
/usr/local/src/apache-tomcat-8.0.35/bin/startup.sh start
8、执行# /usr/local/src/apache-tomcat-8.0.35/bin/startup.sh 启动tomcat, 打开浏览器测试:
9、执行# /usr/local/src/apache-tomcat-8.0.35/bin/shutdown.sh 关闭tomcat
10、tomcat默认监听8080端口,如果要修改成为80端口,按如下步骤修改:
# vim /usr/local/src/apache-tomcat-8.0.35/conf/server.xml
找到
<Connector port=”8080″ protocol=”HTTP/1.1″
connectionTimeout=”20000″
redirectPort=”8443″ />
修改为:
<Connector port=”80″ protocol=”HTTP/1.1″
connectionTimeout=”20000″
redirectPort=”8443″ />
11、重启tomcat生效。
/usr/local/src/apache-tomcat-8.0.35/bin/startup.sh
12、测试Tomcat:
14、至此tomcat安装完毕了。
15、修改Server.xml,使得访问域名时,直接打开特定的项目