![]() |
![]()
As usual, configuring the standalone server is the easiest and best way of testing a virtual host configuration. Virtual hosting in Resin is based on the header in the HTTP request. When a browser contacts a site, it tells the site the host name typed into the request. This means that a site can serve several virtual hosts with the same IP address.The following sample configuration defines two virtual hosts using different application directories.
A more common configuration uses virtual hosts with Apache. Apache is better able to handle IP-based virtual hosting. (Getting the IP-address from Java is embarassingly slow.) The directive in Apache is vital to make Resin's virtual hosting work. When Apache passes the request to Resin, it tells Resin the . Without the , Resin can get very confused which host to serve.
In some ISP setups, it may make sense to assign a JVM for each virtual host. In some cases, the isolation of web-apps is not sufficient; each user needs a separate JVM. In this configuration, each JVM needs its own srun-port and possibly its own srun-host. In the most straightforward configuration, each JVM gets its own resin.conf. The resin.conf can use resin:include to share common configuration.
Here's the corresponding gryffindor resin.conf
In an alternate configuration, the JVMs can share the same resin.conf, each with a block, but each listens to a different port.
The resin.conf is identical to the resin.conf at the top of this page. You'll need to start the server with to give the server it's own port.
|