Home | Mirror | Search |
例 104.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>
例 104.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>
例 104.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>
例 104.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>
例 104.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>
<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
例 104.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>
例 104.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>