Re: Configuring Apache Web Server with Tomcat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want apache httpd running on front and wants to forward the jsp/servlet requests to tomcat only. I want my static pages and photos to be processed by apache and want to configure it through mod_ajp


I have come up with some settings which actually helped me in forwarding the reqeust to tomcat. But now i can't add ProxyPassMatch directive to it.. here are the configurations i have done in httpd.conf file

------
one of the best explanation. I have been trying to work on it since yesterday but could not figure it out. but now it's working

ok one question, i want to add ProxyPassMatch directive. If i put in VirtualHost then it gives me error. Can someone help?

<VirtualHost *:80>
   ServerName localhost
   <Proxy *>
     AddDefaultCharset Off
     Order deny,allow
     Allow from all
   </Proxy>
 
   ProxyPass / ajp://localhost:8009/
   ProxyPassReverse / ajp://localhost:8009/
#   ProxyPassMatch ^(/photos/.*\.jpg)$!
   
Alias /photos "F:\projects\AL\Photos"

<Directory "F:\projects\AL\Photos">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
   
</VirtualHost>
------

How can if some request is for photos, don't forward, else forward it. Suggestions?

..alee
http://techboard.wordpress.com



On Wed, Jul 15, 2009 at 6:35 PM, David Smith <dns4@xxxxxxxxxxx> wrote:
Tomcat doesn't by default listen on port 80.  I suspect you have Apache
Httpd running and that is giving you the "It works!" message.

8009 is _usually_ the AJP connector that can be used by mod_jk to
connect httpd to tomcat.  Sounds like you've reconfigured it to offer up
straight http protocol instead of ajp protocol.  Could you post the
connectors of your server.xml file?  Please don't include all the
comments that are in there by default.

If you want all your jsp/servlets to be available on port 80, you have
two options:

1. Get rid of httpd and configure a connector of tomcat to listen on port 80
2. Configure mod_jk for your apache httpd to connect to tomcat.

--David

alee amin wrote:
> I am using Tomcat6 but i could not find any thing to put in Connector
> configuration of tomcat file. Can you please help?
> - When i said "working fine" .. i meant that JSP pages are viewable if i
> browse at 8009 (the path i mentioned earlier) but if i don't mention the
> port then it's not working (jsp pages).
>
> - What happens when i start both things.
>    - when i go to site http://localhost/ (it dispalys its works)
>    - If i browse to any site at 8009 .. its works
>    - but if i try to browse to any jsp/servlet at port 80 .. it doesn't
work
> .. (that's the problem).
>
>
> PLEASE tell me which properties should i fix so that i may get tomcat and
> apache working.
>
> ..alee
> http://techboard.wordpress.com
>
>
>
> On Tue, Jul 14, 2009 at 9:54 PM, Christopher Schultz <
> chris@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Alee,
>
> On 7/14/2009 10:44 AM, alee amin wrote:
> >>> I am trying to configuring apache webserver with tomcat using AJP
> but i
> am
> >>> not sure am i doing it right or not.
> [snip]
>
> >>>   <IfModule mod_proxy>
> >>> ProxyPass / ajp://localhost:8009/
> >>> ProxyPassMatch ^(/photos/.*\.jpg)$!
> >>>   </IfModule>
> [snip]
>
> >>> - Added the worker.properties file to Catalina_home/conf directory
> with
> >>> follwoing properties
> You don't need worker.properties if you are using mod_proxy_ajp.
> worker.properties is only for using mod_jk (an alternative to
> mod_proxy_ajp in httpd 2.2, and the only viable game in town for AJP in
> pre-2.2 versions of Apache httpd).
>
> Just get rid of the worker.properties file.
>
> >>>   <Connector
> >>> className="org.apache.ajp.tomcat4.Ajp13Connector"
> >>> port="8009"
> Wow. What version of Tomcat are you attempting to use? This
> configuration looks seriously old. If you are just starting out, try
> using Tomcat 6.
>
> >>> Now i am trying to test to browse some JSP file at the following
> location
> "
> >>> http://localhost:8009/examples/jsp/jsp2/el/basic-arithmetic.jsp" which
> is
> >>> working fine.
> Really? Making an HTTP request on port 8009 isn't going to work: that
> port is serving AJP13 requests. What do you mean it "is working fine"
> when you "test to browse some JSP" files?
>
> >>> but i want to browse this file at
> >>> http://localhost/examples/jsp/jsp2/el/basic-arithmetic.jsp.
> So, you want to use port 80? That's what Apache httpd should be doing
> for you: proxying port 80 traffic through AJP (port 8009) to Tomcat.
>
> >>> Have i done it right or there is something else that i can do?
> What happens when you start everything up and actually try it? If it
> works as expected, I'd say that you have done at least most of it
> correctly.
>
> -chris


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux