阿里雲服務器Linux CentOS安裝配置(六)resin多端口配置、安裝、部署

阿里雲服務器Linux CentOS安裝配置(六)resin多端口配置、安裝、部署

一、下載resin包

    http://caucho.com/download/resin-4.0.48.ziphtml

二、解壓

    unzip resin-4.0.48.zip -d /etc/java

三、啓動resin

    /etc/resin-4.0.48/bin/resin.sh startweb

四、訪問測試

    curl 127.0.0.1:8080服務器

五、探索resin啓動

    cd /etc/resin-4.0.48/app

    重啓:bin/resin.sh restart 沒問題curl

    cd binwebapp

    再重啓:./resin.sh restart 提示錯誤:Error: Unable to access jarfile ./../lib/resin.jarjvm

    開始探索:測試

        一、註釋掉resin.sh的最後一行,並加入下面兩行代碼阿里雲

            echo `pwd`(輸出當前所在目錄)

            echo $JAVA_EXE -jar ${RESIN_HOME}/lib/resin.jar $*

        二、執行命令:./resin.sh start

            輸出:

                /etc/resin-4.0.48(當前所在目錄)

                java -jar ./../lib/resin.jar start

        三、結論:

            ./../lib/resin.jar = /etc/lib/resin.jar

            而resin.jar的實際路徑是:/etc/resin-4.0.48/lib/resin.jar,全部纔有:Error: Unable to access jarfile ./../lib/resin.jar

        四、返回到/etc/resin-4.0.48目錄,執行bin/resin.sh start

            輸出:

                java -jar bin/../lib/resin.jar start

                /etc/resin-4.0.48

                此次:bin/../lib/resin.jar = /etc/resin-4.0.48/lib/resin.jar(看出來沒有,此次指向的resin.jar的路徑是正確的,因此能正常啓動)

        五、探索完畢,還原resin.sh

 

// 上面的配置已經足夠部署項目了,下面咱們來安裝一個resin啓動目錄

六、依次執行下面的命令

    cd /etc/resin-4.0.48/

    不指定jdk時:./configure --prefix=/opt/resin(安裝目錄)

    指定jdk時:./configure --prefix=/opt/resin --with-java-home=/usr/lib/jvm/java-1.7.0 --enable-64bit

    make

    make install

七、啓動

    先中止前面啓動的服務:/etc/resin-4.0.48/bin/resin.sh stop

    啓動resin:service resin start(安裝後就能夠這麼啓動了)

    訪問下試試:http://ip:8080

    查看啓動參數配置:cat -n /etc/init.d/resin

八、添加一個14805端口

    進入配置目錄 cd /opt/resin/conf

    vi resin.xml

    找到下面這段代碼,在它下面拷貝一份

<cluster id="app">
    <!-- define the servers in the cluster -->
    <server-multi id-prefix="app-" address-list="${app_servers}" port="6800"/>

    <host-default>
      <!-- creates the webapps directory for .war expansion -->
      <web-app-deploy path="webapps"
                      expand-preserve-fileset="WEB-INF/work/**"
                      multiversion-routing="${webapp_multiversion_routing}"
                      path-suffix="${elastic_webapp?resin.id:''}"/>
    </host-default>

    <!-- auto virtual host deployment in hosts/foo.example.com/webapps -->
    <host-deploy path="hosts">
      <host-default>
        <resin:import path="host.xml" optional="true"/>
      </host-default>
    </host-deploy>

    <!-- the default host, matching any host name -->
    <host id="" root-directory=".">
      <!--
         - webapps can be overridden/extended in the resin.xml
        -->
      <web-app id="/" root-directory="webapps/ROOT"/>

    </host>
      
    <resin:if test="${resin_doc}">
      <host id="${resin_doc_host}" root-directory="${resin_doc_host}">
        <web-app id="/resin-doc" root-directory="${resin.root}/doc/resin-doc"/>
      </host>
    </resin:if>
  </cluster>

    修改成:

<cluster id="llj">
    <server-multi id-prefix="llj-" address-list="${llj_servers}" port="6800"/>

    <host-default>
      <web-app-deploy path="webapps"
                      expand-preserve-fileset="WEB-INF/work/**"
                      multiversion-routing="${webapp_multiversion_routing}"
                      path-suffix="${elastic_webapp?resin.id:''}"/>
    </host-default>

    <host-deploy path="hosts">
      <host-default>
        <resin:import path="host.xml" optional="true"/>
      </host-default>
    </host-deploy>
   
    <host id="" root-directory=".">
      <web-app id="/" root-directory="webapps/ROOT"/>
    </host>
  </cluster>

    配置端口:

        vi resin.properties,添加下面兩個屬性

llj.http = 14805
llj_servers = 127.0.0.1:6801

    啓動服務:/opt/resin/bin/resin.sh --server llj-0 start

    訪問下試試:curl 127.0.0.1:14805

    到如今爲止,resin上兩個端口8080、14805都啓動好了。它們指向的是同一個應用目錄,你也能夠爲它們指定不一樣的應用目錄 

九、部署項目

    將一個.war文件拷貝到/opt/resin/webapps目錄下,再訪問下兩個端口的服務,顯示的是你項目的首頁,表示部署成功

十、這裏只是簡單的配置、部署,集羣配置詳細後續再講,打完收工

相關文章
相關標籤/搜索