resin 虚拟主机

resin 虚拟主机就是resin根据不同的请求的host名称,将请求分配到不同的虚拟主机上面。那边为什么同一个ip会有不同的主机域名呢?是因为http请求中有一个host名称,通过nginx可以修改这个名称,进而根据不同的请求映射到不同的虚拟主机:

上面是nginx的配置,它如果遇到类似example.com/activity/*的url,它就会设置ip数据包中的host。resin服务器接收到请求,根据请求中的host名称分配请求到不同的虚拟主机。

虚拟主机的定义方式同样有2中。一种的指定的,一种是动态的。

指定的定义方式如下:

<resin xmlns="http://caucho.com/ns/resin"
        xmlns:resin="urn:java:com.caucho.resin">
                    
<cluster id="app-tier">
  <server id="app-a" address="192.168.1.10" port="6800">
    <http port="8080"/>
  </server>
            
  <development-mode-error-page/>
            
  <resin:import path="${__DIR__}/app-default.xml"/>
            
  <host id="">
    <root-directory>/var/resin</root-directory>
            
    <access-log path="logs/access.log"/>
            
    <web-app id="" root-directory="htdocs"/>
  </host>
            
  <host id="www.slytherin.com">
    <host-alias>slytherin.com</host-alias>
                
    <root-directory>/var/slytherin</root-directory>
            
    <access-log path="logs/access.log"/>
            
    <web-app id="" root-directory="htdocs"/>
  </host>
            
</cluster>
</resin>

指定的host定义通过host标签定义。

动态虚拟主机定义:

<resin xmlns="http://caucho.com/ns/resin"
          xmlns:resin="urn:java:com.caucho.resin">
<cluster id="app-tier">
  <server id="app-a" address="192.168.1.13" port="6800">
    <http port="8080"/>
  </server>
        
  <development-mode-error-page/>
        
  <resin:import path="${__DIR__}/app-default.xml"/>
          
  <host-default>
    <resin:import path="host.xml" optional="true"/>
        
    <access-log path="log/access.log"/>
            
    <web-app-deploy path="webapps"
           expand-preserve-fileset="WEB-INF/work/**"/>
  </host-default>
        
  <host-deploy path="hosts">
  </host-deploy>
          
</cluster>
</resin>

动态的虚拟主机定义标签式host-deploy,他定义了虚拟主机的根目录。

目录格式如下:

/var/resin/hosts/www.gryffindor.com/
                                 host.xml
                                 log/access.log
                                 webapps/ROOT/index.jsp
                                 webapps/ROOT/WEB-INF/resin-web.xml
                     
/var/resin/hosts/www.slytherin.com/
                                host.xml
                                log/access.log
                                webapps/ROOT/index.php
                                webapps/ROOT/WEB-INF/resin-web.xml
                     
/var/resin/hosts/default/
                      host.xml
                      log/access.log
                      webapps/ROOT/index.php
                      webapps/ROOT/WEB-INF/resin-web.xml


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值