Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

If I understand correctly you need to replace this line

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

with this line

ProxyPass /blog/ !

This instructs the apache2 server to not to proxy anything that starts with /blog which is I think is what your want.

UPDATE: The official docs is here: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

share|improve this answer
    
1. That doesnt work. It still forwards it to jetty. 2. Do u have any list or website, where I can see various types of proxypass –  theTuxRacer Jan 4 '11 at 5:45
    
EDIT: I changed the order of the ProxyPass, and put the / at the end. Now it works. I guess it would just pass through. Thanks for the answer, I had lost all hope, people like you keep the love alive! Happy new year :) –  theTuxRacer Jan 4 '11 at 5:54
    
Thanks, you are welcome. Fixed I updated my answer accordingly. –  cstamas Jan 8 '11 at 22:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.