howto configure mod_proxy for apache2, jetty

Posted by Kaustubh P on Server Fault See other posts from Server Fault or by Kaustubh P
Published on 2011-01-01T07:55:34Z Indexed on 2011/01/01 9:55 UTC
Read the original article Hit count: 388

Filed under:
|
|

Hello, This is how I have setup my environment, atm. An apache2 instance on port 80. Jetty instance on the same server, on port 8090.

Use-Case:

  • When I visit foo.com, I should see the webapp, which is hosted on jetty, port 8090.

  • If I put foo.com/blog, I should see the wordpress blog, which is hosted on apache. (I read howtos on the web, and installed it using AMP.)

Below are my various configuration files:

/etc/apache2/mods-enabled/proxy.conf:

ProxyPass / http://foo.com:8090/   << this is the jetty server

ProxyPass /blog http://foo.com/blog

ProxyRequests On
ProxyVia On

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

ProxyPreserveHost On

ProxyStatus On

/etc/apache2/httpd.conf:

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_balancer_module /usr/lib/apache2/modules/mod_proxy_balancer.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so

I have not created any other files, in sites-available or sites-enabled.

Current situation:

  • If I goto foo.com, I see the webapp.
  • If I goto foo.com/blog, I see a

HTTP ERROR 404

Problem accessing /errors/404.html. Reason:

NOT_FOUND powered by jetty://

  • If I comment out the first ProxyPass line, then on foo.com, I only see the homepage, without CSS applied, ie, only text..
  • .. and going to foo.com/blog gives me a this error:

The proxy server received an invalid response from an upstream server.

The proxy server could not handle the request GET /blog.

Reason: Error reading from remote server

  • I also cannot access /phpmyadmin, giving the same 404 NOT_FOUND error as above.

I am running Debian squeeze on an Amazon EC2 Instance.

Question: Where am I going wrong? What changes should I make in the proxy.conf (or another conf files) to be able to visit the blog?

© Server Fault or respective owner

Related posts about apache2

Related posts about mod-proxy