views:

284

answers:

2

I'm having trouble with making a subdomain to my Windows computer while using AJP to proxy to Tomcat. This is what I have in my httpd.conf file:

<VirtualHost *:80>
ServerName subdomain.localhost
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / ajp://localhost:8009/folder/
ProxyPassReverse / ajp://localhost:8009/folder/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>

The subdomain has been added to c:\windows\system32\drivers\etc\hosts

127.0.0.1 localhost
127.0.0.1 subdomain.localhost

When I go to http://localhost i goes straight to the proxy. When I go to http://subdomain.localhost i goes to the proxy as well. How do I make is so the subdomain only goes to the proxy and the regular goes to Apache?

A: 

This should probably be moved to superuser.com but one thing to try:

<VirtualHost *:80> informs it to accept all incoming connections on port 80 to use these settings. I would try changing it to say:

<VirtualHost subdomain.localhost:80>

and see if that only applies these settings when the subdomain is used.

The ServerName tag that you put with the subdomain doesn't tell it who to listen for. The official documentation states:

The ServerName directive sets the hostname and port that the server uses to identify itself. This is used when creating redirection URLs. For example, if the name of the machine hosting the web server is simple.example.com, but the machine also has the DNS alias www.example.com and you wish the web server to be so identified, the following directive should be used:

You can read more on these configurations here.

NebuSoft
I tried the subdomin.localhost before and it was still going straight to the tomcat from localhost. Thanks for a response and the link to superuser.com I'll try to distinguish my questions from site to site from today forward.
stan
A: 

You need to declare a second VirtualHost with localhost as the ServerName.

Maurice Perry
Not quite what I was thinking, but it works! Thanks
stan
Learn something new everyday :)
NebuSoft