I only get a 403 Error page when I call the page through 12345.mycompany.com

Including sample from my vhost and server.xml again...

vhost.conf

<!-- This works and only contains statis HTML and Media Files -->
<VirtualHost 94.199.241.124:80>
        DocumentRoot /var/www/html
        ServerName media.mycompany.com
        ErrorLog logs/media_mycompany_error.log
        CustomLog logs/media_mycompany_access.log combined
</VirtualHost>

<!-- This works since I only use www.myothercompany.com -->
<VirtualHost 94.199.241.124:80>
        DocumentRoot /var/www/myothercompany.com
        ServerName myothercompany.com
        ServerAlias *.myothercompany.com

        ProxyPreserveHost On
        ProxyPass / ajp://localhost:8009/
        ProxyPassReverse / ajp://localhost:8009/

        RewriteEngine On
        RewriteRule ^/(.*\.cf[cm]/?.*)$ ajp://localhost:8009/$1 [P]

        ErrorLog logs/myothercompany_error.log
        CustomLog logs/myothercompany_access.log combined
</VirtualHost>

<!-- This works for www.mycompany.com but generates a
     403 Error when I access it with 12345.mycompany.com -->
<!-- Not using this in server.xml I will land on Tomcat Admin
     page when calling it from 12345.mycompany.com -->
        <Valve className="org.apache.catalina.valves.RemoteHostValve"
               allow="*.mycompany.com,www.mycompany.com" />

<VirtualHost 94.199.241.124:80>
        DocumentRoot /var/www/mycompany.com
        ServerName mycompany.com
        ServerAlias *.mycompany.com

        ProxyPreserveHost On
        ProxyPass / ajp://localhost:8009/
        ProxyPassReverse / ajp://localhost:8009/

        RewriteEngine On
        RewriteRule ^/(.*\.cf[cm]/?.*)$ ajp://localhost:8009/$1 [P]
</VirtualHost>

server.xml
<Server port="8005" shutdown="SHUTDOWN">

  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <Service name="Catalina">

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    <Engine name="Catalina" defaultHost="localhost">

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

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

        <Valve className="org.apache.catalina.valves.RemoteHostValve"
               allow="*.mycompany.com,www.mycompany.com" />

        <Valve className="org.apache.catalina.valves.RemoteAddrValve"
deny="192.168.1.*"/>

      </Host>

      <Host name="www.myothercompany.com" appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
            <Context path="" docBase="/var/www/myothercompany.com"
allowLinking="true" />
      </Host>

      <Host name="mycompany.com" appBase="webapps">
            <Alias>www.mycompany.com</Alias>
            <Context path="" docBase="/var/www/mycompany.com"
allowLinking="true" />
      </Host>

    </Engine>
  </Service>
</Server>

Somehow I'm messing something up here...

/Mats/

On Sun, Feb 7, 2010 at 1:58 AM, Nitai @ Razuna <[email protected]> wrote:

> This looks correct. Tomcat knows of no wildcard for domains so you
> have to do it in Apache.
>
> Make sure to clear all caching, restart both servers and try it again.
>
> Kind Regards,
> Nitai
>
> On Sun, Feb 7, 2010 at 12:39 AM, Mats Stromberg <[email protected]>
> wrote:
> > Hi,
> > When I use the www.mydomain.com my page shows up but changing it to
> > 12345.mydomain.com I get the Tomcat Administration page...
> > My Virtual Host  is now
> > <VirtualHost 94.199.241.124:80>
> >         DocumentRoot /var/www/mydomain.com
> >         ServerName mydomain.com
> >         ServerAlias *.mydomain.com
> >         ProxyPreserveHost On
> >         ProxyPass / ajp://localhost:8009/
> >         ProxyPassReverse / ajp://localhost:8009/
> >         RewriteEngine On
> >         RewriteRule ^/(.*\.cf[cm]/?.*)$ ajp://localhost:8010/$1 [P]
> >         ErrorLog logs/mydomain_error.log
> >         CustomLog logs/mydomain_access.log combined
> > </VirtualHost>
> > and in the server.xml I have
> >       <Host name="mydomain.com" appBase="webapps">
> >             <Alias>www.mydomain.com</Alias>
> >             <Context path="" docBase="/var/www/mydomain.com"
> > allowLinking="true" />
> >       </Host>
> > AJP seems to work atleast for the www but not for 1234x.mydomain.com
> > I must be doing something really stupid here that I can't seen...
> > /Mats/
> > On Sat, Feb 6, 2010 at 12:26 AM, Nitai @ Razuna <[email protected]>
> wrote:
> >>
> >> Hi,
> >>
> >> Sorry I was on the "run" the whole day and only got to some eMails
> now...
> >>
> >> Right, I'm just including what I have in my server.xml file here, ok?.
> >> So here we go:
> >>
> >> <Host name="localhost"  appBase="webapps" unpackWARs="true"
> >> autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
> >> </Host>
> >>
> >> <!-- HOST: Razuna -->
> >> <Host name="razuna.org" appBase="webapps">
> >> <Alias>www.razuna.org</Alias>
> >> <Context path="" docBase="ABSOLUTEPATHHERE" allowLinking="true" />
> >>  </Host>
> >>
> >> <Host name="razuna.com" appBase="webapps" unpackWARs="true"
> >> autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false">
> >> <Context path="" docBase="ABSOLUTEPATHHERE" allowLinking="true" />
> >> </Host>
> >>
> >> In Apache I then have a virtual host like (you need to create virtual
> >> hosts for each host that you have in tomcat):
> >>
> >> <VirtualHost *:80>
> >> ServerName razuna.com
> >> DocumentRoot ABSOLUTEPATHHERE
> >>
> >> ProxyPreserveHost On
> >> ProxyPass / ajp://localhost:8010/
> >> ProxyPassReverse / ajp://localhost:8010/
> >>
> >> RewriteEngine On
> >> RewriteRule ^/(.*\.cf[cm]/?.*)$ ajp://localhost:8010/$1 [P]
> >> </VirtualHost>
> >>
> >> Note: You use the SAME DocumentRoot in Apache as the docBase in
> >> Tomcat. With the RewriteRule you tell Apache to get CFM files from
> >> Tomcat and the rest will be served by Apache directly (static files,
> >> JS, CSS, images, etc).
> >>
> >> This should get you going. If not, check that you have the
> >> mod_proxy_ajp enabled in Apache. Let me know how it works.
> >>
> >> Kind Regards,
> >> Nitai
> >>
> >>
> > --
> > Open BlueDragon Public Mailing List
> > http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
> > mailing list - http://groups.google.com/group/openbd?hl=en
> >
> > !! save a network - please trim replies before posting !!
>
>
>
> --
> See for yourself how easy it is to manage files today. Join the revolution!
>
> Razuna SaaS On-Demand - Hosted Digital Asset Management Solution
> http://www.razuna.com/
>
> Razuna - Open Source Digital Asset Management
> http://www.razuna.org/
>
> Follow us on Twitter
> http://twitter.com/razunahq
>
> --
> Open BlueDragon Public Mailing List
>  http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
>  mailing list - http://groups.google.com/group/openbd?hl=en
>
>  !! save a network - please trim replies before posting !!
>

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 mailing list - http://groups.google.com/group/openbd?hl=en

 !! save a network - please trim replies before posting !!

Reply via email to