I running my little blog on Tomcat 6 server. My hosting company allows me to set up multiple sub domains. I was trying to do for last few hours, but no luck. Having started with

<Engine name="Catalina" defaultHost="mydomain.co.uk">

      <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>


      <Host name="mydomain.co.uk" appBase="/home/user/public_html" unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
         <Alias>www.mydomain.co.uk</Alias>
         <Context path="" reloadable="true" docBase="/home/user/public_html" />
         <Context path="/manager" docBase="/usr/local/tomcat/users/user/tomcat/webapps/manager"
                  privileged="true" antiResourceLocking="false" antiJARLocking="false" reloadable="true" />
      </Host>

    </Engine>

I added new host to engine as

<Host name="code.mydomain.co.uk" appBase="/home/user/code_public_html" unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
         <Alias>code.mydomain.co.uk</Alias>
         <Context path="" reloadable="true" docBase="/home/user/code_public_html" />
      </Host>

I tried to also follow Virtual Hosting and Tomcat 1 and 2 (2nd one is currently in place).

I created basic web app structure of WEB-INF (web.xml, classes, lib), index.html and index.jsp. However I'm getting 403

You don't have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Suggestion???

As it happens I cannot create new folder in root to hold subdomain, hosting restriction. I must create new folder inside public_html and then it will work.

Problem solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.