Can't stop/start lighttpd


#1

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”
)


#2

On 07/02/06, Nick C. removed_email_address@domain.invalid wrote:

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.

That’s probably port 80. Are you sure you’re shutting it down correctly?

server.port = 80


Rasputin :: Jack of All Trades - Master of Nuns
http://number9.hellooperator.n


#3

That’s probably port 80. Are you sure you’re shutting it down correctly?

I’m pretty sure, I’m using:

/etc/init.d/lighttpd start/stop/restart/reload/force-reload (not all at
once :slight_smile: )

One other thing. when I click on “About your applicationâ??s environment”
I get a 404 - Not Found instead of the typical “For security purposes,
this information is only available to local requests.”

Nick


#4

Nick C. wrote:

That’s probably port 80. Are you sure you’re shutting it down correctly?

I’m pretty sure, I’m using:

/etc/init.d/lighttpd start/stop/restart/reload/force-reload (not all at
once :slight_smile: )

One other thing. when I click on “About your applicationâ??s environment”
I get a 404 - Not Found instead of the typical “For security purposes,
this information is only available to local requests.”

If you’re using firefox 1.5 try clearing all your cache files. I know
this sounds dumb, but I had a similar problem and it was solved by doing
that.

Jeroen


#5

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:

to restart the server, I get an error saying that the port that I?m
server.document-root = “/var/coar/public/”

need to execute a second request while the first is still pending.

)
“.swf” => “application/x-shockwave-flash”,

-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
removed_email_address@domain.invalid