0

Please excuse my ignorance on this topic. I've read and read, searched and searched and I'm still struggling with my setup.

I'm trying to setup my httpd.conf to allow one domain, with two directories to resolve to two different tomcat instances.

www.example.com/first

<VirtualHost "ip address":80>
        ServerName example/first
        ErrorLog /var/log/httpd/first_error.log
        CustomLog /var/log/httpd/first_access.log combined

        <Proxy *>
                AddDefaultCharset off
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPass / ajp://localhost:8009/
        ProxyPassReverse / ajp://localhost:8009/
</VirtualHost>

www.example.com/second

<VirtualHost "ip address":80>
        ServerName example/second
        ErrorLog /var/log/httpd/second_error.log
        CustomLog /var/log/httpd/second_access.log combined

        <Proxy *>
                AddDefaultCharset off
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPass / ajp://localhost:8010/
        ProxyPassReverse / ajp://localhost:8010/
</VirtualHost>

I know this is wrong, and I think I'm supposed to use <Directory>, or should I be specifying the tomcat instance in:

ProxyPass /example1 ajp://localhost:8010/

ProxyPass /example2 ajp://localhost:8009/

Please send help. Supplies/morale are low.

or links to examples... Thank you!!

Andrew B
  • 32,588
  • 12
  • 93
  • 131
Fred
  • 143
  • 1
  • 8
  • I'm curious where this falls into not being "Questions must be relevant to professional system administration.", and flagged as off topic? – Fred May 09 '14 at 18:29
  • Probably not the best vote close reason, yeah. It wasn't the one I chose. – Andrew B May 09 '14 at 21:01
  • The only reason I worded it the way I did was in case someone else with less knowledge was having the same problem, then at least the search engines could index it. I found very little. So then @AndrewB shames me for asking a question he thinks should be easy, I point it out to him, so he edits his question then my question is put on hold as off-topic? I see what serverfault is becoming. If you don't have 15 years of experience with everything server related then you aren't welcome to post here. Keep it classy. – Fred May 12 '14 at 23:12
  • I edited your question because your edit duplicated your answer. This is a commonplace edit on all SE sites, not just ServerFault. I do not intend to address the remainder of your comment as my reply would not add any value to this Q+A. Please continue this discussion in [meta.SF](http://meta.serverfault.com/) if you feel that I have legitimately aggrieved you. I do not intend to participate, as I have already stated once (prior to our comments being moderated) that it was not intended as the insult you have taken it for. – Andrew B May 12 '14 at 23:26
  • I have edited my answer based on your feedback. The original wording can be found in the changelog. – Andrew B May 12 '14 at 23:38

2 Answers2

1

For your first split-URI proxy, I recommend that you avoid <Location> and <Directory>. Directories map to actual filesystem directories, while Locations map to URI paths. The latter is what you're trying to accomplish, but you don't actually need a container to make this work. (it just makes the config cleaner)

Use a single <VirtualHost>, with ProxyPass /first ajp://localhost:8009 and ProxyPass /second ajp://localhost:8010. I could give you the full config, but I'd like you to try a little harder. If you work out the above confusion you're very close to having this done.

Andrew B
  • 32,588
  • 12
  • 93
  • 131
0

Solved.

<VirtualHost "ip address":80>
            ServerName example.com
            ErrorLog /var/log/httpd/error.log
            CustomLog /var/log/httpd/access.log combined

            ProxyPass /first/ ajp://localhost:8009/first/

            ProxyPass /second/ ajp://localhost:8010/second/

</VirtualHost>
Fred
  • 143
  • 1
  • 8