Lighttpd proxy w/ apache2


#1

I’ve tried a bunch of things trying to get ruby/apache2 and php working
together. I looked over my earlier post and followed the instructions
on ezra’s website to install lighttpd on debian. I’ve gotten really far
but I think there is one bit missing:

  1. I got apache2 and php working together
  2. I got lighttpd working on port 3000 and my rails app launches ok
    there

So at this stage, both PHP and Ruby are on the same server except that
ruby is on port 3000 while the rest is going on port 80.

  1. I copied/pasted this vhost section into my apache2/sites-enabled
    folder in order to pass the sites that will be using ruby to lighttpd

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
#ProxyPreserveHost on #<-apache2 only
ProxyPass / http://example.com:8000/
ProxyPassReverse / http://example.com:8000/

changing the example.com to my URL.

  1. I got an error so I used a2enmod proxy. Stopped and restarted apache2
  2. After doing that when I go to my URL I get a 403 error: Forbidden

In fact, I can’t go to any IP/URL on that server without seeing a 403.
So even the PHP stuff broke at that stage.

It’s linked to the ProxyPass statements somehow. I’ve tried messing
with proxy.conf in my apache2/mods-enabled folder but that didn’t seem
to do anything.

I also changed lighttpd.conf to run on port 8000 in case that was the
error but that also didn’t change anything.

So now I’m at the stage where if I keep the proxy module I get the 403
error and if I don’t I can get to my PHP stuff, but can’t get to my
rails app.

Is there some last step I’m missing?


#2

On Dec 7, 2005, at 7:41 PM, Vince W. wrote:

there
#ProxyPreserveHost on #<-apache2 only
ProxyPass / http://example.com:8000/
ProxyPassReverse / http://example.com:8000/

I use apache 1.3.x so the vhost was mainly for that version. But
after taking a look to see what the preferred way to do this on
apache2 is I cam up with this that is better for apache2:

<VirtualHost :80>
ServerAdmin removed_email_address@domain.invalid
ServerName example.com:80
ProxyRequests Off
ProxyPreserveHost On
RewriteEngine On
RewriteRule ^/(.
) http://127.0.0.1:3000/$1 [P,L]
ProxyPassReverse / http://127.0.0.1:3000/

HTH-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
removed_email_address@domain.invalid


#3

On 08/12/05, Ezra Z. removed_email_address@domain.invalid wrote:

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ProxyPass / http://example.com:8000/
ProxyPassReverse / http://example.com:8000/

I use apache 1.3.x so the vhost was mainly for that version. But
after taking a look to see what the preferred way to do this on
apache2 is I cam up with this that is better for apache2:

Sorry, how is that better? You’re just using mod_rewrite to do the
same thing as the ‘proxypass’ directive.

<VirtualHost :80>
ServerAdmin removed_email_address@domain.invalid
ServerName example.com:80
ProxyRequests Off
ProxyPreserveHost On
RewriteEngine On
RewriteRule ^/(.
) http://127.0.0.1:3000/$1 [P,L]
ProxyPassReverse / http://127.0.0.1:3000/


Rasputin :: Jack of All Trades - Master of Nuns
http://number9.hellooperator.net/


#4

On Dec 9, 2005, at 4:23 AM, Dick D. wrote:

after taking a look to see what the preferred way to do this on
RewriteEngine On
RewriteRule ^/(.*) http://127.0.0.1:3000/$1
[P,L]
ProxyPassReverse / http://127.0.0.1:3000/

Well the only reason it is better is that it works while the old way
doesn’t :wink: So thats good enough for me.

Cheers-

-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
removed_email_address@domain.invalid