Virtual Hosts using Hosts Directory

From Resin 3.0

Jump to: navigation, search
40px-Edit-clear.png This article requires cleanup and may refer to a legacy version of Resin.

Please visit for the most up-to-date documentation.

When you have a large site with many virtual hosts, you can use Resin's <host-deploy> tag and the hosts/ directory to manage the virtual hosts without modifying the resin.xml file.

The directory structure for the virtual hosts would look something like:


The hosts/ directory works just like the webapps/ directory. Resin scans the deployment directory for hosts, when it finds one, it automatically creates a new virtual host with the host contents.

Typically, a host-deploy will use a standard configuration with a host-default and web-app-default so all web-apps behave similarly.

resin.xml for hosts/ deployment

<resin xmlns=""

  <cluster id="">
    <resin:import path="${__DIR__}/app-default.xml"/>

    <server id="" port="6800">
      <http port="80"/>


      <web-app-deploy path="webapps"/>
      <access-log path="log/access.log"/>

    <host-deploy path="hosts"/>
  • The ${resin.root} directory is /var/www
  • The app-default.xml resin:import defines standard servlet behavior like JSP, PHP and static files
  • The user-name changes to the resin user from root for security
  • The host-default configures the webapps/ directory and an access-log for every virtual host
  • The host-deploy configures the hosts/ directory in /var/www/hosts
Personal tools