Say you want to host 2 projects called foo and bar in resin. Let us assume their war names are foo.war and bar.war.

  • Create folders called foo and bar inside your resin folder.
  • Create a folder called webapps inside the above created folders.

War files are deployed in the above created webapps folder.

Now add the following elements under the server tag of resin.conf file.

<host regexp="foo\.com">
  <host-name>foo.com</host-name>
  <root-directory>foo</root-directory>
  <web-app id="/" document-directory="webapps/foo">
    <session-config>
      <cookie-domain>foo.com</cookie-domain>
    </session-config>
  </web-app>
</host>
		
<host regexp="bar\.com">
  <host-name>bar.com</host-name>
  <root-directory>bar</root-directory>
  <web-app id="/" document-directory="webapps/bar">
    <session-config>
      <cookie-domain>bar.com</cookie-domain>
    </session-config>
  </web-app>
</host>

In the above document-directory=”webapps/bar”, the part after webapps has to match your war file name.

Add the following to your hosts file:

127.0.0.1 foo.com
127.0.0.1 bar.com

Now you are all set to go.

Advertisements