You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Nathan Quirynen <na...@pensionarchitects.be> on 2015/05/08 09:14:10 UTC
[users@httpd] Subdomain vritual host proxy to Tomcat with ajp
I have a domain domain.com that points to a server. Now I have a
subdomain sub.domain.com that points to another server that has Apache
running and Tomcat. I want this subdomain to point to a application
deployed on the Tomcat instance through ajp.
I have configured the following in httpd.conf:
|
<VirtualHost *:80>
ServerName sub.domain.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
</VirtualHost>
|
and in Tomcats server.xml:
|<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
|
But when I go to sub.domain.com the url changes to otherdomain.com and
shows me a php website running in Apache and declared as following in
httpd.conf:
|<VirtualHost *:80>
DocumentRoot /var/www/html/otherdomain.com
ServerName otherdomain.com
ServerAlias www.otherdomain.com
</VirtualHost>
|
I only get it to work when I change the port in the sub.domain.com
virtual host declaration to for example 8001. Then when I go to
sub.domain.com:8001 it shows my tomcat application (ROOT.war) as expected.
So my question is: what could be going wrong that it doesn't work with
the default port 80? I can't find any configuration that is causing
this, but I'm probably missing something or is my virtual host
configuration wrong?
Re: [users@httpd] Subdomain vritual host proxy to Tomcat with ajp
Posted by Nathan Quirynen <na...@pensionarchitects.be>.
Apparently my configuration is correct. It was just my browsers cache
playing tricks on me.
Anyways, happy this is solved!
On 08/05/15 09:14, Nathan Quirynen wrote:
>
> I have a domain domain.com that points to a server. Now I have a
> subdomain sub.domain.com that points to another server that has Apache
> running and Tomcat. I want this subdomain to point to a application
> deployed on the Tomcat instance through ajp.
>
> I have configured the following in httpd.conf:
>
> |
> <VirtualHost *:80>
> ServerName sub.domain.com
> ProxyRequests Off
> ProxyPreserveHost On
> <Proxy *>
> Order deny,allow
> Allow from all
> </Proxy>
> ProxyPass / ajp://localhost:8009/
> ProxyPassReverse / ajp://localhost:8009/
> </VirtualHost>
> |
>
> and in Tomcats server.xml:
>
> |<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
> |
>
> But when I go to sub.domain.com the url changes to otherdomain.com and
> shows me a php website running in Apache and declared as following in
> httpd.conf:
>
> |<VirtualHost *:80>
> DocumentRoot /var/www/html/otherdomain.com
> ServerName otherdomain.com
> ServerAliaswww.otherdomain.com
> </VirtualHost>
> |
>
> I only get it to work when I change the port in the sub.domain.com
> virtual host declaration to for example 8001. Then when I go to
> sub.domain.com:8001 it shows my tomcat application (ROOT.war) as expected.
>
> So my question is: what could be going wrong that it doesn't work with
> the default port 80? I can't find any configuration that is causing
> this, but I'm probably missing something or is my virtual host
> configuration wrong?
>