Nick-
The /etc/init.d/lighttpd command on debian doesn''t seem to shut down
the dispacth fcgi processes very well and sometimes not even lighty
either. I am assuming you installed lighty from a .deb package from
somewhere. I have a brute force script that will work for you.
But before that there are a few issues I see in your conf file here.
server.error-handler-404 = "/var/coar/public/dispatch.cgi"
should be
server.error-handler-404 = "/dispatch.fcgi"
Also you are spawning 5 fcgi listeners with the min-max procs
statements. Unless your site is getting around 80,000 hits a day you
dont need anywhere near that amount of listeners. You should set
bothe the min-procs and max-procs to either 1 or 2 and make sure they
are both set to the same number of procs. The dynamic spawning is
disabled in lighty in all newer versions so the min-procs doesn''t
really do much. Start with 2 listeners, you will be bale to handle
quite a bit of traffic with just 2.
And here is a script for you that will restart lighty and the
dispacthers for you. Put this in a file somehwere like this:
in: /usr/local/bin/bounce
#!/usr/bin/ruby
lighty = `cat /var/run/lighttpd.pid`.strip
dis = `ps axww | grep dispatch | grep -v grep | grep /var/coar/public/
dispatch.fcgi`
dispatchers = dis.split(/\n/).map {|line| line.strip.scan(/\d*/).first }
puts "\nLighttpd pid: #{lighty}"
puts ''=''*25
puts "dispatch.fcgi''s pids: #{dispatchers.join(" :
")}"
if system "kill -9 #{lighty} #{dispatchers.join(''
'')}"
# make sure to change the follwing line to point to the correct
# lighttpd.conf file for your app.
system "/usr/sbin/lighttpd -f /path/to/lighttpd.conf"
puts "Restarted Lighttpd & Dispatchers..."
else
puts "Error occured. Please restart lighty by hand"
end
Now you can restart your lighttpd and fcgi processes by typing:
$ bounce
Make sure to chmod +x the bounce file after you save it so its
executable.
Cheers-
-Ezra
On Feb 7, 2006, at 7:40 AM, Nick C. wrote:
> Hello everyone,
>
> I?ve been working with Ruby on Rails for about 2 months now and have
> really enjoyed the ease of use of it. I?m only been doing development
> on it so I?ve been using WeBrick. Recently, I have built a server
> running Debian Linux, with ruby 1.8.2, rails 1.0.0, lighty 1.4.3, and
> Mysql 5.0.18. I used WeBrick to generate a lighttpd.conf file for
> me, I
> changed the paths in the file to absolute paths. I''m not even
sure is
> all is working because I discovered thant when I start lighty then try
> to restart the server, I get an error saying that the port that I?m
> using is already in use. Here is my lighttpd.conf file:
>
> server.port = 80
> server.username = "www-data"
> server.groupname = "www-data"
> server.pid-file = "/var/run/lighttpd.pid"
>
> server.modules = ( "mod_rewrite",
"mod_accesslog",
> "mod_fastcgi" )
> server.error-handler-404 = "/var/coar/public/dispatch.cgi"
> server.document-root = "/var/coar/public/"
>
> server.errorlog = "/var/log/error.log"
> accesslog.filename = "/var/log/access.log"
>
> url.rewrite = ( "^/$" => "index.html",
"^([^.]+)$" =>
> "$1.html" )
>
> # Change *-procs to 2 if you need to use Upload Progress or other
> tasks
> that
> # *need* to execute a second request while the first is still pending.
> fastcgi.server = ( ".fcgi" =>
> ( "localhost" =>
> (
> "min-procs" => 1,
> "max-procs" => 5,
> "socket" => "/var/log/fcgi.socket",
> "bin-path" =>
"/var/coar/public/dispatch.fcgi",
> "bin-environment" => ( "RAILS_ENV" =>
"development" )
> )
> )
> )
>
> mimetype.assign = (
> ".css" => "text/css",
> ".gif" => "image/gif",
> ".htm" => "text/html",
> ".html" => "text/html",
> ".jpeg" => "image/jpeg",
> ".jpg" => "image/jpeg",
> ".js" => "text/javascript",
> ".png" => "image/png",
> ".swf" => "application/x-shockwave-flash",
> ".txt" => "text/plain"
> )
>
>
> --
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-Ezra Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com