VMware Linux 下 Nginx 安裝配置 - Tomcat 配置 (二)

來源:互聯網
上載者:User

標籤:des   style   blog   http   io   ar   color   使用   sp   

準備工作

1. 選在 /usr/local/ 下建立 softs 檔案夾,通過 ftp 命令 把 apache-tomcat-7.0.26.tar.gz 拷貝進來;

2. 再在 /usr/local/ 下建立 Tomcat8080以及Tomcat8090 兩個檔案夾;

將 /softs/apache-tomcat-7.0.26.tar.gz 解壓到 local/tomcat8080下;

定位到 softs:

softs>tar -xzvf apache-tomcat-7.0.26.tar.gz -C /usr/local/tomcat8080

然後它會把整個 apache-tomcat-7.0.26 檔案夾放在 tomcat8080下,為使不用那麼多層次,

還得把 apache-tomcat-7.0.26 下的所有檔案及子檔案夾全都拷到 tomcat8080 下;

tomcat8080>cp -avx /usr/local/tomcat8080/apache-tomcat-7.0.26/* /usr/local/tomcat8080

然後再刪除 apache-tomcat-7.0.26 檔案夾:

tomcat8080>rm -rf apache-tomcat-7.0.26;

然後再將 tomcat8080 下的檔案及子檔案夾,全都拷到 tomcat8090 下;

配置 兩個或以上 Tomcat

1. 編輯 profile 檔案;

>vi /etc/profile

如果要有行號,再輸入: (不必敲 ‘i‘)

:set nu

即可顯示行號;

在 export 相應位置行前後輸入:

2. 再到 第二個 Tomcat 即 Tomcat8090 的 bin 下 ,  vi 開啟 catalina.sh 輸入:

export CATALINA_BASE=$CATALINA_2_BASEexport CATALINA_HOME=$CATALINA_2_HOME

我添加到 第一個 while done 代碼塊下面;

如果沒有在 /etc/profile 配置 JDK 環境變數,也可以 catalina.sh 配置,就是配置在 上面兩句的上面;

export JAVA_HOME=/usr/java/jdk1.7.0_21export CLASSPATH=.:$JAVA_HOME/libpathmunge .:$JAVA_HOME/bin#或#export PATH=.:$JAVA_HOME/bin

3. 分配置配完後,重啟 linux : reboot;

或:

source /etc/profile

重啟成功後,輸入命令:

ps -ef |grep tomcat

有輸入一大串資訊出來,就表示安裝成功;

啟動 Tomcat: 選測試 8090 連接埠的:

cd /usr/local/tomcat8090/binstartup.sh

有出現如下資訊:

表示 Tomcat 正常啟動;

用同樣的方式,啟動 tomcat8080 的 Tomcat;

4. 在 windows 分別開啟 8080 及 8090 的兩個網站; webapps/ROOT:

選查下 虛擬機器 IP 是多少:

ifconfig
inet 後的即是 IP 位址: 分別開啟 http://xxx.xxx.xxx.xxx:8080/ 及 http://xxx.xxx.xxx.xxx:8090 看是否正常;

檢查防火牆及關閉防火牆

有時候,Linux 上 Tomcat 都正常開啟了,windows 上 訪問不到,有可能是 Linux 開啟了防火牆;1. 使用:
iptables -L#或#/usr/sbin/iptables -L

查看防火牆狀態,如果出現如下資訊,表示防火牆沒有開啟;

Chain INPUT (policy ACCEPT)target     prot opt source               destination         Chain FORWARD (policy ACCEPT)target     prot opt source               destination         Chain OUTPUT (policy ACCEPT)target     prot opt source               destination 

2. 使用:

iptables -Xiptables -F

就可以關閉防火牆了;

VMware Linux 下 Nginx 安裝配置 - Tomcat 配置 (二)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.