5.4. virtual hosts

简介:

5.4.1. explicit host

例 5.1. explicit host in resin.conf

				
<resin xmlns="http://caucho.com/ns/resin">
<cluster id="">

<host host-name="www.foo.com">
  <host-alias>foo.com</host-alias>
  <host-alias>web.foo.com</host-alias>

  <root-directory>/opt/www/www.foo.com</root-directory>

  <web-app id="/" document-directory="webapps/ROOT">

  </web-app>
  ...
</host>

</cluster>
</resin>
				
				

5.4.2. regexp host

例 5.2. regexp host in resin.conf

				
<resin xmlns="http://caucho.com/ns/resin">
<cluster id="">

<host regexp="([^.]+)\.foo\.com">
  <host-name>${host.regexp[1]}.foo.com</host-name>

  <root-directory>/var/www/hosts/www.${host.regexp[1]}.com</root-directory>

  ...
</host>

</cluster>
</resin>
				
				

5.4.3. host-alias

例 5.3. host-alias in the resin.conf

				
<resin xmlns="http://caucho.com">
<cluster id="">

  <host id="www.foo.com" root-directory="/var/www/foo.com">
    <host-alias>foo.com</host-alias>

    <web-app id=""/>
  </host>

</cluster>
</resin>
				
				

例 5.4. host-alias in a /var/www/hosts/foo/host.xml

				
<host xmlns="http://caucho.com">

  <host-name>www.foo.com</host-name>
  <host-alias>foo.com</host-alias>

  <web-app id="" root-directory="htdocs"/>

</host>
				
				

例 5.5. host-alias-regexp in the resin.conf

				
<resin xmlns="http://caucho.com">
<cluster id="">

  <host id="www.foo.com" root-directory="/var/www/foo.com">
    <host-alias-regexp>.*foo.com</host-alias-regexp>

    <web-app id=""/>
  </host>

</cluster>
</resin>
				
				

5.4.4. configures a deployment directory for virtual hosts

			
<resin xmlns="http://caucho.com/ns/resin">
  <cluster id="app-tier">
    <root-directory>/var/www</root-directory>

    <host-deploy path="hosts">
      <host-default>
        <resin:import path="host.xml" optional="true"/>

        <web-app-deploy path="webapps"/>
      </host-default>
    </host-deploy>
  </cluster>
</resin>
			
			

$RESIN_HOME/hosts其下的任何目录将对应一个虚拟主机。在$RESIN_HOME/hosts下也可以放置jar文件,其会被展开变成一个虚拟主机。

$RESIN_HOME/hosts/www.example.com
$RESIN_HOME/hosts/www.example.net
$RESIN_HOME/hosts/www.example.org
			

5.4.5. Resources

例 5.6. shared database in host

				
<resin xmlns="http://caucho.com/ns/resin">
  <cluster id="app-tier">
     <server id="a" .../>

     <host id="www.foo.com">
        <database jndi-name="jdbc/test">
            <driver type="org.postgresql.Driver">
                <url>jdbc:postgresql://localhost/test</url>
                <user>caucho</user>
            </driver>
        </database>

        <web-app-default path="webapps"/>
    </host>
  </cluster>
</resin>
				
				

Oracle JDBC

				
<database>
	<jndi-name>jdbc/test</jndi-name>
	<driver type="oracle.jdbc.pool.OracleConnectionPoolDataSource">
	<url>jdbc:oracle:thin:@172.16.0.1:1521:database</url>
	<user>user</user>
	<password>password</password>
	</driver>
	<prepared-statement-cache-size>8</prepared-statement-cache-size>
	<max-connections>1024</max-connections>
	<max-idle-time>20s</max-idle-time>
</database>
				
				

例 5.7. rewrite-dispatch

				
<resin xmlns="http://caucho.com/ns/resin">
  <cluster id="app-tier">

    <host host-name="www.foo.com">
      <rewrite-dispatch>
        <redirect regexp="^/foo" target="/index.php?foo="/>
      </rewrite-dispatch>
    </host>

  </cluster>
</resin>
				
		





原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
相关文章
|
Linux 网络安全 网络协议
|
关系型数据库 Java 数据库连接
|
JavaScript Linux 前端开发
|
Linux 网络协议
|
API 数据库 网络虚拟化
|
关系型数据库 MySQL 网络安全
openstack: No valid host was found. There are not enough hosts available
这个问题,可以先重启nova和neutron中的服务,再重启 如果依旧出现这样的问题,可以中下面进行排查 这个问题产生的很大原因有:1)计算节点的内存不足、CPU资源不够、硬盘空间资源不足造成的;将云主机类型规格调小点,发现就能创建成功。
2260 0