Forum: Ruby on Rails lighttpd proxy w/ apache2

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
26ca684555abbdb44f01bd1e165e649b?d=identicon&s=25 Vince W. (vince)
on 2005-12-08 04:41
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.

3. 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/
</VirtualHost>

changing the example.com to my URL.

4. I got an error so I used a2enmod proxy. Stopped and restarted apache2
5. 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?
8e44c65ac5b896da534ef2440121c953?d=identicon&s=25 ezra (Guest)
on 2005-12-08 19:55
(Received via mailing list)
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/
> </VirtualHost>
>


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                 webmaster@username.tld
         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/
</VirtualHost>

HTH-
-Ezra Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
A52b0e1c5d982f2512a03c5dbfd033d6?d=identicon&s=25 rasputnik (Guest)
on 2005-12-09 13:24
(Received via mailing list)
On 08/12/05, Ezra Zygmuntowicz <ezra@yakimaherald.com> wrote:

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

> 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                 webmaster@username.tld
>          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/
> </VirtualHost>


--
Rasputin :: Jack of All Trades - Master of Nuns
http://number9.hellooperator.net/
8e44c65ac5b896da534ef2440121c953?d=identicon&s=25 ezra (Guest)
on 2005-12-09 19:09
(Received via mailing list)
On Dec 9, 2005, at 4:23 AM, Dick Davies 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/
>> </VirtualHost>
>

Well the only reason it is better is that it works while the old way
doesn't ;-) So thats good enough for me.

Cheers-

-Ezra Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
This topic is locked and can not be replied to.