- 下載并解壓縮tomcat
[root@admin local]# cd /usr/local
[root@admin local]# wget http://apache.fayea.com/apache-mirror/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.tar.gz
[root@admin local]# tar -zxv -f apache-tomcat-7.0.29.tar.gz // 解壓壓縮包
[root@admin local]# rm -rf apache-tomcat-7.0.29.tar.gz // 刪除壓縮包
[root@admin local]# mv apache-tomcat-7.0.29 tomcat
- 啟動Tomcat
[root@admin ~]# /usr/local/tomcat/bin/startup.sh //啟動tomcat
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.7.0/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
- 開放8080端口
[root@admin ~]# vi + /etc/sysconfig/iptables
添加以下代碼
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
重啟防火墻
[root@admin java]# service iptables restart
檢測Tomcat:訪問 網(wǎng)址:8080
停止Tomcat
[root@admin ~]# /usr/local/tomcat/bin/shutdown.sh //停止tomcat
- 設(shè)置默認(rèn)訪問路徑
方法1:
將項目改為ROOT
方法2:(建議使用這種方式)
<Context path="" docBase="D:\tomcat\webapps\項目文件夾名稱" debug="0" reloadable="true" />
- 設(shè)置默認(rèn)頁面
<welcome-file-list>
<welcome-file>VideoManager</welcome-file>
</welcome-file-list>