我是靠谱客的博主 魁梧棒棒糖,最近开发中收集的这篇文章主要介绍resin 虚拟主机配置,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述


安装 jdk 

wget http://nj02.poms.baidupcs.com/file/32f19f3a0fb872f363689c85321e0021?bkt=p3-140032f19f3a0fb872f363689c85321e0021c081421d00000391386b&fid=2150970041-250528-268937617971823&time=1459413386&sign=FDTAXGERLBH-DCb740ccc5511e5e8fedcff06b081203-SnGL2x7Z1%2BShaJH1EWDKxTe5hoE%3D&to=n2b&fm=Nan,B,T,t&sta_dx=57&sta_cs=0&sta_ft=gz&sta_ct=0&fm2=Nanjing02,B,T,t&newver=1&newfm=1&secfm=1&flow_ver=3&pkey=140032f19f3a0fb872f363689c85321e0021c081421d00000391386b&sl=77660238&expires=8h&rt=pr&r=440362609&mlogid=2103402834800013704&vuk=2150970041&vbdid=1645308789&fin=server-jre-8u77-linux-x64.tar.gz&fn=server-jre-8u77-linux-x64.tar.gz&slt=pm&uta=0&rtype=1&iv=0&isw=0&dp-logid=2103402834800013704&dp-callid=0.1.1  


tar -xf server-jre-8u77-linux-x64.tar.gz

mkdir /usr/local/java 

mv jdk1.8.0_77/ /usr/local/java/


vim /etc/profile 在末尾加上如下


export JAVA_HOME=/usr/local/java/jdk1.8.0_77/

export CLASSPATH=$CLASSPATH:$JAVA_HOMEb:$JAVA_HOME/jreb

export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin


source /etc/profile

[root@han2 java]# source /etc/profile

[root@han2 java]# java -version

 

java version "1.8.0_77"

Java(TM) SE Runtime Environment (build 1.8.0_77-b03)

Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)


安装 resin


wget http://nj01ct01.baidupcs.com/file/068982f303ad297c3b503c5b1c2f5aa5?bkt=p3-1400068982f303ad297c3b503c5b1c2f5aa52287038a00000198c14b&fid=2150970041-250528-245424891824325&time=1459413383&sign=FDTAXGERLBH-DCb740ccc5511e5e8fedcff06b081203-tlqf9rrO7bkrIHND7XfiMoNhrFo%3D&to=njhb&fm=Nan,B,T,t&sta_dx=26&sta_cs=0&sta_ft=gz&sta_ct=0&fm2=Nanjing,B,T,t&newver=1&newfm=1&secfm=1&flow_ver=3&pkey=1400068982f303ad297c3b503c5b1c2f5aa52287038a00000198c14b&sl=77660238&expires=8h&rt=pr&r=163555855&mlogid=2103401997557105771&vuk=2150970041&vbdid=1645308789&fin=resin-4.0.44.tar.gz&fn=resin-4.0.44.tar.gz&slt=pm&uta=0&rtype=1&iv=0&isw=0&dp-logid=2103401997557105771&dp-callid=0.1.1


tar -xf resin-4.0.44.tar.gz

cd resin-4.0.44 

./configure --prefix=/usr/local/resin --with-resin-log=/usr/local/resin/logs --with-java-home=/usr/local/java/jdk1.8.0_77/ 

make make install 


/usr/local/resin/bin/resinctl 启动 


虚拟主机配置 


cd /usr/local/resin

cp -r webapps webapps2

cp conf/resin.xml conf/resin2.xml


修改resin2.xml 如下红色部分



<cluster id="app2">

    <!-- define the servers in the cluster -->

    <server-multi id-prefix="app2-" address-list="${app_servers2}" port="6801"/>


    <host-default>

      <!-- creates the webapps directory for .war expansion -->

      <web-app-deploy path="webapps2"

                      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="webapps2/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="web">

    <!-- define the servers in the cluster -->

    <server-multi id-prefix="web-" address-list="${web_servers}" port="6810"/>


    <host id="" root-directory="web">

      <web-app id="">

        <resin:LoadBalance regexp="" cluster="app2"/>

      </web-app>


      <web-app id="/async">

        <resin:LoadBalance regexp="" cluster="app2"/>

      </web-app>

    </host>

  </cluster>




修改resin.properties 文件 

添加 app2.http : 8081  app_servers2 : 127.0.0.1:6801 



app_servers      : 127.0.0.1:6800

app_servers2      : 127.0.0.1:6801




app.http          : 8080

app2.http          : 8081



修改完后启动服务 




/usr/local/resin/bin/resin.sh -conf /usr/local/resin/conf/resin.xml start


/usr/local/resin/bin/resin.sh -conf /usr/local/resin/conf/resin2.xml start


测试 


vim /usr/local/resin/webapps/ROOT/index.jsp 


 <body>

<h1>han1 TOMCAT_1 JSP Test Page</h1>

<%=new java.util.Date()%>

</body>

</html>


vim /usr/local/resin/webapps2/ROOT/index.jsp 


 <body>

<h1>han2 TOMCAT_1 JSP Test Page</h1>

<%=new java.util.Date()%>

</body>

</html> 


chmiod +x /usr/local/resin/webapps/ROOT/index.jsp

chmiod +x /usr/local/resin/webapps2/ROOT/index.jsp



到此完成  关于动静分离 和负载均衡 和tomcat 一样 这里就不演示了 



转载于:https://blog.51cto.com/7456193/1758895

最后

以上就是魁梧棒棒糖为你收集整理的resin 虚拟主机配置的全部内容,希望文章能够帮你解决resin 虚拟主机配置所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(51)

评论列表共有 0 条评论

立即
投稿
返回
顶部