why the lucky stiff
2006-Jul-25 07:03 UTC
+ camping 1.4.140 -- apache+fastcgi, lighttpd+fastcgi
Okay, I have tested mounting several of my apps under Lighttpd and Apache, both running FastCGI. I''m going to explain the configuration, but first: update. gem install camping --source code.whytheluckstiff.net == Mounting Root for Lighttpd+FastCGI = server.port = 3045 server.bind = "192.168.0.103" server.modules = ( "mod_fastcgi" ) server.document-root = "/usr/local/www/data/examples/" server.errorlog = "/usr/local/www/data/examples/error.log" #### fastcgi module fastcgi.server = ( "" => ( "localhost" => ( "socket" => "/tmp/camping-examples.socket", "bin-path" => "/usr/local/www/data/examples.rb", "bin-environment" => ("FORCE_ROOT" => "1"), "check-local" => "disable", "max-procs" => 1 ) ) ) Notice the FORCE_ROOT setting. When you mount at "", PATH_INFO breaks. Lots of other web framework just use SCRIPT_NAME everytime lighttpd is found (see: Jifty, Catalyst.) I don''t want to do that, it''s unpredictable. Mount at "" and use FORCE_ROOT. DO NOT MOUNT AT "/". == Mounting Root for Apache2+FastCGI = AddHandler fastcgi-script rb ScriptAlias / /usr/local/www/data/examples.rb/ This is if mod_fastcgi is loaded. I haven''t figured out mod_fcgid yet. == Mounting Subdirectory for Lighttpd+FastCGI = server.port = 3045 server.bind = "192.168.0.103" server.modules = ( "mod_fastcgi" ) server.document-root = "/usr/local/www/data/examples/" server.errorlog = "/usr/local/www/data/examples/error.log" #### fastcgi module fastcgi.server = ( "/examples" => ( "localhost" => ( "socket" => "/tmp/camping-examples.socket", "bin-path" => "/usr/local/www/data/examples.rb", "check-local" => "disable", "max-procs" => 1 ) ) ) No need to use FORCE_ROOT. DO NOT PUT A SLASH AT THE END OF YOUR SUBDIRECTORY NAME. See, "/examples/" will break the above. == Mounting Subdirectory for Apache2+FastCGI = AddHandler fastcgi-script rb ScriptAlias /examples /usr/local/www/data/examples.rb/ == What does /usr/local/www/data/examples.rb look like? = I''m testing with all my development paths in there. #!/home/why/sand/RUBY-1_8_HEAD/bin/ruby require ''rubygems'' require ''camping/fastcgi'' Camping::Models::Base.establish_connection :adapter => ''sqlite3'', :database => "/tmp/camping.db" Camping::FastCGI.serve("/home/why/cvs/camping/examples/") == What if I only want to serve up one file? = Change the path. Point to a file instead of a directory. See the last line here: #!/home/why/sand/RUBY-1_8_HEAD/bin/ruby require ''rubygems'' require ''camping/fastcgi'' Camping::Models::Base.establish_connection :adapter => ''sqlite3'', :database => "/tmp/camping.db" Camping::FastCGI.serve("/home/why/cvs/camping/examples/blog.rb") These changes only work with r140. _why
Manfred Stienstra
2006-Jul-25 07:36 UTC
+ camping 1.4.140 -- apache+fastcgi, lighttpd+fastcgi
On 25-jul-2006, at 9:03, why the lucky stiff wrote:> Okay, I have tested mounting several of my apps under Lighttpd and > Apache, > both running FastCGI. I''m going to explain the configuration, but > first: > update.Ah very nice, thanks _why. Are you putting this on the wiki as well?
actually I cannot beleive it, I also got it to work, with 1.4.139 :) [mathieu at hikonehq /usr/home/mathieu/camping]$ diff -r /usr/local/lib/ruby/gems/1.8/gems/camping-1.4.139/lib lib Only in lib: .svn Only in lib/camping: .svn diff -r /usr/local/lib/ruby/gems/1.8/gems/camping-1.4.139/lib/camping/fastcgi.rb lib/camping/fastcgi.rb 75c75 < path = req.env[''SCRIPT_NAME''] + req.env[''PATH_INFO''].to_s ---> path = req.env[''SCRIPT_NAME''] + req.env[''PATH_INFO'']126c126 < Dir[File.join(path, ''*.{rb,fcgi}'')].each &script_load ---> Dir[File.join(path, ''*.rb'')].each &script_load130,131c130,131 < Dir[File.join(path, dir, ''*.{rb,fcgi}'')].each do |script| < smount = "/" + script # .gsub(/\.(rb|fcgi)$/, '''') ---> Dir[File.join(path, dir, ''*.rb'')].each do |script| > smount = "/" + File.basename(script, ''.rb'')[mathieu at hikonehq /usr/home/mathieu/camping]$ svn stat lib [mathieu at hikonehq /usr/home/mathieu/camping]$ please pay attention here. /usr/local/lib/ruby/gems/1.8/gems/camping-1.4.139/lib/ is the MODIFIED version ./lib is unmodified. with this patch 139 works with Apache 2.2 and mod_fastcgi which is all I care about. now _why thanks for your advice with ScriptAlias I might just use that to hide the cgi name thanks a bunch ! now the fun starts !!!!!!!!!!!!!!!!! On 7/25/06, why the lucky stiff <why at whytheluckystiff.net> wrote:> > Okay, I have tested mounting several of my apps under Lighttpd and Apache, > both running FastCGI. I''m going to explain the configuration, but first: > update. > > gem install camping --source code.whytheluckstiff.net > > == Mounting Root for Lighttpd+FastCGI => > server.port = 3045 > server.bind = "192.168.0.103" > server.modules = ( "mod_fastcgi" ) > server.document-root = "/usr/local/www/data/examples/" > server.errorlog = "/usr/local/www/data/examples/error.log" > > #### fastcgi module > fastcgi.server = ( "" => ( > "localhost" => ( > "socket" => "/tmp/camping-examples.socket", > "bin-path" => "/usr/local/www/data/examples.rb", > "bin-environment" => ("FORCE_ROOT" => "1"), > "check-local" => "disable", > "max-procs" => 1 ) ) ) > > Notice the FORCE_ROOT setting. When you mount at "", PATH_INFO > breaks. Lots of > other web framework just use SCRIPT_NAME everytime lighttpd is found (see: > Jifty, Catalyst.) I don''t want to do that, it''s unpredictable. > > Mount at "" and use FORCE_ROOT. DO NOT MOUNT AT "/". > > == Mounting Root for Apache2+FastCGI => > AddHandler fastcgi-script rb > ScriptAlias / /usr/local/www/data/examples.rb/ > > This is if mod_fastcgi is loaded. I haven''t figured out mod_fcgid yet. > > == Mounting Subdirectory for Lighttpd+FastCGI => > server.port = 3045 > server.bind = "192.168.0.103" > server.modules = ( "mod_fastcgi" ) > server.document-root = "/usr/local/www/data/examples/" > server.errorlog = "/usr/local/www/data/examples/error.log" > > #### fastcgi module > fastcgi.server = ( "/examples" => ( > "localhost" => ( > "socket" => "/tmp/camping-examples.socket", > "bin-path" => "/usr/local/www/data/examples.rb", > "check-local" => "disable", > "max-procs" => 1 ) ) ) > > No need to use FORCE_ROOT. DO NOT PUT A SLASH AT THE END OF YOUR > SUBDIRECTORY > NAME. See, "/examples/" will break the above. > > == Mounting Subdirectory for Apache2+FastCGI => > AddHandler fastcgi-script rb > ScriptAlias /examples /usr/local/www/data/examples.rb/ > > == What does /usr/local/www/data/examples.rb look like? => > I''m testing with all my development paths in there. > > #!/home/why/sand/RUBY-1_8_HEAD/bin/ruby > require ''rubygems'' > require ''camping/fastcgi'' > Camping::Models::Base.establish_connection :adapter => ''sqlite3'', > :database => "/tmp/camping.db" > Camping::FastCGI.serve("/home/why/cvs/camping/examples/") > > == What if I only want to serve up one file? => > Change the path. Point to a file instead of a directory. See the last > line > here: > > #!/home/why/sand/RUBY-1_8_HEAD/bin/ruby > require ''rubygems'' > require ''camping/fastcgi'' > Camping::Models::Base.establish_connection :adapter => ''sqlite3'', > :database => "/tmp/camping.db" > Camping::FastCGI.serve("/home/why/cvs/camping/examples/blog.rb") > > These changes only work with r140. > > _why > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- gcc -O0 -DRUBY_EXPORT -rdynamic -Wl,-export-dynamic -L. main.o -lruby-static -ldl -lcrypt -lm -o ruby Everyone is trying their hardest to do their job but management has set it up so that it''s impossible. Take the control over your money, track your expenses http://justbudget.com Mathieu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20060725/ff34e044/attachment-0001.html
why the lucky stiff
2006-Jul-25 14:42 UTC
+ camping 1.4.140 -- apache+fastcgi, lighttpd+fastcgi
On Tue, Jul 25, 2006 at 09:36:02AM +0200, Manfred Stienstra wrote:> Ah very nice, thanks _why. Are you putting this on the wiki as well?Yes, they are under TheCampingServer recipes[1]. _why [1] http://code.whytheluckystiff.net/camping/wiki/TheCampingServer#WebServerRecipes