After a horrible evening of absolutely no success at getting lighttpd to do FastCGI with my rails app, I decided to ask if anyone else has run into similar problems. First, all of these URLs refer to a common problem: http://bougyman.com/miscfiles/RailsonDebian.html http://dev.rubyonrails.org/ticket/1268 http://forum.textdrive.com/viewtopic.php?pid=33403 Either the fcgi library has bugs (EAGAIN problems) OR problems where FCGI.each_cgi is not supported and there needs to be some edit of the dispatch.fcgi. I actually ended up gutting the default generated dispatch.fcgi to the bare essentials before I got rid of the missing each_cgi error. That error is the most frustrating because I can''t really figure out where people are getting the other API. If they are getting it someplace then why is the fcgi gem recommended? Seems that the fcgi gem isn''t really the right thing to use. Second, there seems to be very little documentation that I could find on lighttpd+fcgi on Linux. It all seems to be done with Apache: http://wiki.rubyonrails.com/rails/show/FastCGI+on+unix+linux+bsd http://wiki.rubyonrails.com/rails/show/RailsOnFedora Is this due to lighttpd problems or just familiarity with Apache? What have been people''s successes with this approach. Finally, has anyone got the scripts here to work on Linux (or anywhere): http://www.bigbold.com/snippets/posts/show/175 Seems to be decent, but just repeatedly causes problems like constantly spawning a mysteriously crashing dispatch.fcgi (which, incidentally does NOT write a message as to why it is exiting. booooh. booooh. bad bad bad. booh to the person who wrote that. boooh. :-) I''m more just curious if other Linux users have had similar troubles. Zed A. Shaw
> <snip> > I''m more just curious if other Linux users have had similar troubles. > > Zed A. Shaw > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >Zed- I have installed the lighttpd/fcgi setup multiple times on 3 different linux distros and osx with the lighttpd launcher script from bigbold.com/snippets. The following instructions I wrote for installing from source have worked every time. Good luck with it and let me know if you run into problems and will try to help. Install the complete Ruby on Rails and Lighttpd/fastcgi/php Stack from source with the fastcgi dev kit and the pcre''s. This has been tested on RHEL4, Debian Sarge, Ubuntu and OSX. It should work on most Linux Distro''s and probably BSD as well(not tested) __________________________________________________ ______________ Get Ruby1.8.2 wget http://rubyforge.org/frs/download.p...by-1.8.2.tar.gz tar xvzf ruby-* cd ruby-1.8.2 ./configure make make test sudo make install __________________________________________________ ______________ Get Ruby gems wget http://rubyforge.org/frs/download.p...gems-0.8.10.tgz tar xvzf rubygems* cd rubygems* sudo ruby setup.rb __________________________________________________ ______________ Get Rails and a few other gems sudo gem install rails RedCloth search_generator salted_login_generator production_log_analyzer answer yes to all dependencies __________________________________________________ ______________ Get mysql-ruby C bindings (the pure ruby ones suck) wget http://www.tmtm.org/en/mysql/ruby/mysql-ruby-2.6.tar.gz tar zxvf mysql-ruby-* cd mysql-ruby-* ruby extconf.rb --with-mysql-config make sudo make install __________________________________________________ ______________ download fastcgi developers kit wget http://fastcgi.com/dist/fcgi.tar.gz tar xvzf fcgi-2.4.0.tar.gz cd fcgi* ./configure make sudo make install __________________________________________________ ______________ Get the new non memory leaking ruby-fastcgi bindings wget http://sugi.nemui.org/pub/ruby/fcgi...gi-0.8.6.tar.gz tar xzvf ruby-fcgi* ruby install.rb config --without-ext ruby install.rb setup sudo ruby install.rb install __________________________________________________ ______________ We need the correct pcre .so’s for lighttpd to work correctly wget ftp://ftp.csx.cam.ac.uk/pub/softwar...pcre-5.0.tar.gz tar xzvf pcre-5.0.tar.gz cd pcre-* ./configure make sudo make install __________________________________________________ ______________ Get lighttpd wget http://www.lighttpd.net/download/lighttpd-1.3.13.tar.gz tar xzvf lighttpd-1.3.13.tar.gz cd lighttpd-* ./configure make sudo make install __________________________________________________ ______________ Compile php as a fast-cgi binary The main thing here is the following configure options. You can add whatever else you like to your php binary but these are needed for fast-cgi support. $ ./configure \ --enable-fastcgi \ --enable-discard-path \ --enable-force-cgi-redirect \ __________________________________________________ ______________ Lighttpd Launcher Script Here is a link for a sweet enhancement. Put this script in your RAILS_ROOT/script folder and put the lighttpd.conf file in RAILS_ROOT/ config. Now you can launch your rails app by cd’ing into your RAILS_ROOT for your app and typing: $ruby script/lighty -p 7500 -e development (or whatever port & env you want to use) Now you can hit http://localhost:7500/ and you will get your app running on lighttpd no muss no fuss. Very sweet for development. Here is the link: http://www.bigbold.com/snippets/posts/show/303 . Name the first ruby script lighty and name the config file lighttpd.conf. Now every time you start your app this way is creates a new lighttpd.conf in /tmp and starts lighttpd up with that file. This way you can give it command line options as to what port to bind to and others. I’m using this for development and it is sweet! -Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org 509-577-7732 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> > I''m more just curious if other Linux users have had similar troubles. > > Zed A. Shaw > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >Zed- One more thing... They have just released lighttpd 1.3.14 which fixes a few bugs with fcgi and I have found to be much more stable. So change the version of lighttpd in the instructions I just posted. -Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org 509-577-7732
On 6/16/05, Zed A. Shaw <zedshaw-dd7LMGGEL7NBDgjK7y7TUQ@public.gmane.org> wrote:> After a horrible evening of absolutely no success at getting lighttpd to > do FastCGI with my rails app, I decided to ask if anyone else has run > into similar problems.I had a bit of trouble setting it up at first, but after following these instructions: http://bougyman.com/miscfiles/RailsonDebian.html I finally got a working rails/lighttpd/linux solution going. It''s not impossible. And since I''ve got that done, fastcgi gem 0.8.6 has come out, and lighttpd 1.3.14, which both contains lots of fixes & improvements, so it should be easier now than before. Unfortunately it''s been a while and i don''t remember the specific issues I had, just that those instructions from bougyman.com helped me out quite a lot. -- Urban Artography http://artography.ath.cx
Ezra, Do you have this written up on the net anywhere? This is something I definately want to bookmark... sam On 6/17/05, Ezra Zygmuntowicz <ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org> wrote:> > <snip> > I''m more just curious if other Linux users have had similar troubles. > > Zed A. Shaw > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > Zed- > I have installed the lighttpd/fcgi setup multiple times on 3 different > linux distros and osx with the lighttpd launcher script from > bigbold.com/snippets. The following instructions I wrote for installing from > source have worked every time. Good luck with it and let me know if you run > into problems and will try to help. > > Install the complete Ruby on Rails and Lighttpd/fastcgi/php Stack from > source with the fastcgi dev kit and the pcre''s. This has been tested on > RHEL4, Debian Sarge, Ubuntu and OSX. It should work on most Linux Distro''s > and probably BSD as well(not tested) > __________________________________________________ > ______________ > Get Ruby1.8.2 > > wget http://rubyforge.org/frs/download.p...by-1.8.2.tar.gz > tar xvzf ruby-* > cd ruby-1.8.2 > ./configure > make > make test > sudo make install > __________________________________________________ > ______________ > > Get Ruby gems > > wget http://rubyforge.org/frs/download.p...gems-0.8.10.tgz > tar xvzf rubygems* > cd rubygems* > sudo ruby setup.rb > __________________________________________________ > ______________ > > Get Rails and a few other gems > > sudo gem install rails RedCloth search_generator salted_login_generator > production_log_analyzer > answer yes to all dependencies > __________________________________________________ > ______________ > > Get mysql-ruby C bindings (the pure ruby ones suck) > > wget > http://www.tmtm.org/en/mysql/ruby/mysql-ruby-2.6.tar.gz > tar zxvf mysql-ruby-* > cd mysql-ruby-* > ruby extconf.rb --with-mysql-config > make > sudo make install > __________________________________________________ > ______________ > > download fastcgi developers kit > > wget http://fastcgi.com/dist/fcgi.tar.gz > tar xvzf fcgi-2.4.0.tar.gz > cd fcgi* > ./configure > make > sudo make install > __________________________________________________ > ______________ > > Get the new non memory leaking ruby-fastcgi bindings > > wget http://sugi.nemui.org/pub/ruby/fcgi...gi-0.8.6.tar.gz > tar xzvf ruby-fcgi* > ruby install.rb config --without-ext > ruby install.rb setup > sudo ruby install.rb install > __________________________________________________ > ______________ > > We need the correct pcre .so''s for lighttpd to work correctly > > wget ftp://ftp.csx.cam.ac.uk/pub/softwar...pcre-5.0.tar.gz > tar xzvf pcre-5.0.tar.gz > cd pcre-* > ./configure > make > sudo make install > __________________________________________________ > ______________ > > Get lighttpd > > wget > http://www.lighttpd.net/download/lighttpd-1.3.13.tar.gz > tar xzvf lighttpd-1.3.13.tar.gz > cd lighttpd-* > ./configure > make > sudo make install > __________________________________________________ > ______________ > > Compile php as a fast-cgi binary The main thing here is the following > configure options. You can add whatever else you like to your php binary but > these are needed for fast-cgi support. > > $ ./configure \ > --enable-fastcgi \ > --enable-discard-path \ > --enable-force-cgi-redirect \ > __________________________________________________ > ______________ > > Lighttpd Launcher Script > > Here is a link for a sweet enhancement. Put this script in your > RAILS_ROOT/script folder and put the lighttpd.conf file in > RAILS_ROOT/config. Now you can launch your rails app by cd''ing into your > RAILS_ROOT for your app and typing: > $ruby script/lighty -p 7500 -e development (or whatever port & env you want > to use) > > Now you can hit http://localhost:7500/ and you will get your app running on > lighttpd no muss no fuss. Very sweet for development. Here is the link: > http://www.bigbold.com/snippets/posts/show/303 . Name the > first ruby script lighty and name the config file lighttpd.conf. Now every > time you start your app this way is creates a new lighttpd.conf in /tmp and > starts lighttpd up with that file. This way you can give it command line > options as to what port to bind to and others. I''m using this for > development and it is sweet! > > > -Ezra Zygmuntowicz > WebMaster > Yakima Herald-Republic Newspaper > ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org > 509-577-7732 > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- sam http://www.magpiebrain.com/
Patrick Jordan-Smith
2005-Jun-17 09:49 UTC
Re: FastCGI on Linux: Any Actual Sucess Stories?
Zed- If your installing on debian, in addition to whats listed you need the libfcgi-ruby1.8 package along with libfcgi-dev if your compiling lighttpd. One thing to check is run the dispatch.fcgi by hand (ie, change to your $RAILSAPP/public directory and execute ruby dispatch.fcgi) it should execute and ask for param=value pairs from the standard input, if it doesn''t, you can post the error output here and I''m sure someone will be able to tell you whats going on. The first time I tried this I had troubles because I didn''t have the fcgi support installed. Regards, -- patpatnz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Sam Newman wrote:> Do you have this written up on the net anywhere? This is something I > definately want to bookmark...+1... a Wiki page on this would be fantastic. In the meantime, I''m bookmarking: http://article.gmane.org/gmane.comp.lang.ruby.rails/12460 ~Dave -- Dave Silvester Rent-A-Monkey Website Development Web: http://www.rentamonkey.com/
Sam- Yes I have put this info up at http://www.rubyforums.com/ showthread.php?t=22 . Enjoy ;-) -Ezra On Jun 17, 2005, at 2:30 AM, Sam Newman wrote:> Ezra, > > Do you have this written up on the net anywhere? This is something I > definately want to bookmark... > > sam > > On 6/17/05, Ezra Zygmuntowicz <ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org> wrote: > >> >> <snip> >> I''m more just curious if other Linux users have had similar troubles. >> >> Zed A. Shaw >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> Zed- >> I have installed the lighttpd/fcgi setup multiple times on 3 >> different >> linux distros and osx with the lighttpd launcher script from >> bigbold.com/snippets. The following instructions I wrote for >> installing from >> source have worked every time. Good luck with it and let me know >> if you run >> into problems and will try to help. >> >> Install the complete Ruby on Rails and Lighttpd/fastcgi/php Stack >> from >> source with the fastcgi dev kit and the pcre''s. This has been >> tested on >> RHEL4, Debian Sarge, Ubuntu and OSX. It should work on most Linux >> Distro''s >> and probably BSD as well(not tested) >> __________________________________________________ >> ______________ >> Get Ruby1.8.2 >> >> wget http://rubyforge.org/frs/download.p...by-1.8.2.tar.gz >> tar xvzf ruby-* >> cd ruby-1.8.2 >> ./configure >> make >> make test >> sudo make install >> __________________________________________________ >> ______________ >> >> Get Ruby gems >> >> wget http://rubyforge.org/frs/download.p...gems-0.8.10.tgz >> tar xvzf rubygems* >> cd rubygems* >> sudo ruby setup.rb >> __________________________________________________ >> ______________ >> >> Get Rails and a few other gems >> >> sudo gem install rails RedCloth search_generator >> salted_login_generator >> production_log_analyzer >> answer yes to all dependencies >> __________________________________________________ >> ______________ >> >> Get mysql-ruby C bindings (the pure ruby ones suck) >> >> wget >> http://www.tmtm.org/en/mysql/ruby/mysql-ruby-2.6.tar.gz >> tar zxvf mysql-ruby-* >> cd mysql-ruby-* >> ruby extconf.rb --with-mysql-config >> make >> sudo make install >> __________________________________________________ >> ______________ >> >> download fastcgi developers kit >> >> wget http://fastcgi.com/dist/fcgi.tar.gz >> tar xvzf fcgi-2.4.0.tar.gz >> cd fcgi* >> ./configure >> make >> sudo make install >> __________________________________________________ >> ______________ >> >> Get the new non memory leaking ruby-fastcgi bindings >> >> wget http://sugi.nemui.org/pub/ruby/fcgi...gi-0.8.6.tar.gz >> tar xzvf ruby-fcgi* >> ruby install.rb config --without-ext >> ruby install.rb setup >> sudo ruby install.rb install >> __________________________________________________ >> ______________ >> >> We need the correct pcre .so''s for lighttpd to work correctly >> >> wget ftp://ftp.csx.cam.ac.uk/pub/softwar...pcre-5.0.tar.gz >> tar xzvf pcre-5.0.tar.gz >> cd pcre-* >> ./configure >> make >> sudo make install >> __________________________________________________ >> ______________ >> >> Get lighttpd >> >> wget >> http://www.lighttpd.net/download/lighttpd-1.3.13.tar.gz >> tar xzvf lighttpd-1.3.13.tar.gz >> cd lighttpd-* >> ./configure >> make >> sudo make install >> __________________________________________________ >> ______________ >> >> Compile php as a fast-cgi binary The main thing here is the following >> configure options. You can add whatever else you like to your php >> binary but >> these are needed for fast-cgi support. >> >> $ ./configure \ >> --enable-fastcgi \ >> --enable-discard-path \ >> --enable-force-cgi-redirect \ >> __________________________________________________ >> ______________ >> >> Lighttpd Launcher Script >> >> Here is a link for a sweet enhancement. Put this script in your >> RAILS_ROOT/script folder and put the lighttpd.conf file in >> RAILS_ROOT/config. Now you can launch your rails app by cd''ing >> into your >> RAILS_ROOT for your app and typing: >> $ruby script/lighty -p 7500 -e development (or whatever port & env >> you want >> to use) >> >> Now you can hit http://localhost:7500/ and you will get your app >> running on >> lighttpd no muss no fuss. Very sweet for development. Here is the >> link: >> http://www.bigbold.com/snippets/posts/show/303 . Name the >> first ruby script lighty and name the config file lighttpd.conf. >> Now every >> time you start your app this way is creates a new lighttpd.conf >> in /tmp and >> starts lighttpd up with that file. This way you can give it >> command line >> options as to what port to bind to and others. I''m using this for >> development and it is sweet! >> >> >> -Ezra Zygmuntowicz >> WebMaster >> Yakima Herald-Republic Newspaper >> ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org >> 509-577-7732 >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> >> > > > -- > sam > http://www.magpiebrain.com/ > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org 509-577-7732