Lighttpd and Apache .. will they play together?

Can someone point me to a tutorial or web example of doing this …

I want to have a site that is normally pure content served via Apache
and I
want to set up a Rails app on the same box that is served via lighttpd.
Now
I want the Apache site to be able to retrieve formatted pages for MySQL
database queries by the Rails app. I will also be using ActionMailer
under
the Rails app.

How can I get those two things to work together. The Apache server
talks to
the default port 80 and I have the lighttpd talking to another port on
the
same machine. The port that lighttpd talks to is not open to the
Firewall
but can be reached with localhost:XXXX.

All comments welcome
john

On 2/24/06, John N. Alegre [email protected] wrote:

same machine. The port that lighttpd talks to is not open to the Firewall
but can be reached with localhost:XXXX.

http://wiki.rubyonrails.org/rails/pages/HowToInstallLighttpdOnFreeBsdViaProxyPassThroughFromApache

I have no idea if this actually works or not, but I’ve been doing some
reading because I have the exact situation coming up soon. (i.e. PHP
apps running behind Apache virtual hosts, with the need to add
lighttpd+Rails on a new virtual host on the same box)

– James

James L. wrote:

On 2/24/06, John N. Alegre [email protected] wrote:

How can I get those two things to work together. The Apache server talks to
the default port 80 and I have the lighttpd talking to another port on the
same machine. The port that lighttpd talks to is not open to the Firewall
but can be reached with localhost:XXXX.

http://wiki.rubyonrails.org/rails/pages/HowToInstallLighttpdOnFreeBsdViaProxyPassThroughFromApache

I have no idea if this actually works or not, but I’ve been doing some
reading because I have the exact situation coming up soon.

Yes, the Apache config on that HowTo page will work just fine. I’m not
sure I
fully agree with the use of RewriteEngine, when ProxyPass should work
just fine,
with less memory impact on your Apache processes, but if you need to
send any
custom HTTP headers in to your Rails app, from the Apache side, then
mod_rewrite
is what you need to use.

This is what I do, using a really nice writeup from James Duncan
Davidson:

http://duncandavidson.com/essay/2006/01/railsReverseProxyWithSsl

He’s doing Apache front-ending for his Rails apps in the same way that I
am.

-Brian

On Feb 24, 2006, at 8:24 AM, James L. wrote:

ActionMailer under
http://wiki.rubyonrails.org/rails/pages/
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Here is an example of the apache vhosts I use to do this same thing.

One for apache 1.3 and one for 2.X.:

http://brainspl.at/articles/2005/11/08/apache-vhost-to-proxy-thru-to-
lighttpd-on-a-higher-port

You will need to do some fiddling if you want to proxy not

everything but just a few urls.

Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster

509-577-7732
[email protected]

Brian,

Thanks for the pointers.

Considering the Apache problems with FastCGI and the issue of drag
with a relaunch of the Ruby interpreter for each CGI call it would be
my opinion that for a small App doing what we are talking about here,
i.e. running the Rails app under lighttpd and have Apache talk to it
would be pretty common.

On another note. What would be the issues changed if lighttpd was on
another box on the same LAN ??

Thanks for your continued comments.

john