John N. Alegre
2006-Feb-24 16:15 UTC
[Rails] 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
James Ludlow
2006-Feb-24 16:24 UTC
[Rails] lighttpd and Apache .. will they play together?
On 2/24/06, John N. Alegre <lists@johnalegre.net> wrote:> 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.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
Brian V. Hughes
2006-Feb-24 17:01 UTC
[Rails] lighttpd and Apache .. will they play together?
James Ludlow wrote:> On 2/24/06, John N. Alegre <lists@johnalegre.net> 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
John N. Alegre
2006-Feb-24 18:46 UTC
[Rails] lighttpd and Apache .. will they play together?
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 On Friday 24 February 2006 11:01, Brian V. Hughes wrote:> James Ludlow wrote: > > On 2/24/06, John N. Alegre <lists@johnalegre.net> 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/HowToInstallLighttpdOnFre > >eBsdViaProxyPassThroughFromApache > > > > 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 > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Ezra Zygmuntowicz
2006-Feb-24 19:29 UTC
[Rails] lighttpd and Apache .. will they play together?
On Feb 24, 2006, at 8:24 AM, James Ludlow wrote:> On 2/24/06, John N. Alegre <lists@johnalegre.net> wrote: >> 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. > > 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 > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > 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 Zygmuntowicz Yakima Herald-Republic WebMaster http://yakimaherald.com 509-577-7732 ezra@yakima-herald.com