Start / Stop / Restart Lighttpd Web Server on Linux / Unix

Posted on in Categories , , last updated November 2, 2013

I‘m unable to find any command(s) to stop lighttpd web server. How do I stop / start / restart Lighttpd on Debian/Ubuntu Linux installed using apt-get command? How do I restart lighttpd on RHEL / CentOS installed using yum command? How do I restart lighttpd on FreeBSD Unix operating systems?

You can use the following commands to control Lighttpd web server.

a] /etc/init.d/lighttpd A sys v style script On Linux distro to start / stop / restart lighttpd web server.

b] kill command.

c] pkill command.

d] killall command.

To stop lighttpd:

Just type the following command to stop lighttpd:
# /etc/init.d/lighttpd stop

To start lighttpd:

Just type the following command to stop lighttpd:
# /etc/init.d/lighttpd start

To restart lighttpd:

Just type the following command to restart lighttpd:
# /etc/init.d/lighttpd restart

Debian / Ubuntu Linux start lighttpd

# /etc/init.d/lighttpd start

Debian / Ubuntu Linux stop lighttpd

# /etc/init.d/lighttpd stop

Debian / Ubuntu Linux rstart lighttpd

# /etc/init.d/lighttpd restart

FreeBSD sart lighttpd

# /usr/local/etc/rc.d/lighttpd start

FreeBSD stop lighttpd

# /usr/local/etc/rc.d/lighttpd stop

FreeBSD restart lighttpd

# /usr/local/etc/rc.d/lighttpd restart

pkill/kill/killall command examples

Alert: The following commands needs root level access and need good understanding of command line options

Kill lighttpd

If you don’t have sys v style init script, type the following command to kill lighttpd on Linux operating systems:
# killall lighttpd
OR
# pkill -KILL -u lighttpdUserNameHere lighttpd

Reload lighttpd

To reload lighttpd when you do not have sys v style init script, enter:
# kill -HUP $(cat /path/to/lighttpd.pid-file)
/var/run/lighttpd.pid is the standard location for the PID of the running lighttpd process, so enter:
# kill -HUP $(cat /var/run/lighttpd.pid)

Start lighttpd

To start lighttpd when you do not have sys v style init script, enter:
# /sbin/lighttpd -f /path/to/lighttpd.conf

Restart lighttpd

Type the following two commands to restart lighttpd when you do not have sys v style init script:
# pkill -KILL -u lighttpdUserNameHere lighttpd
# /sbin/lighttpd -f /path/to/lighttpd.conf

See lighttpd(8) for more information.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

2 comment

  1. hi ,

    I am using lighttpd with C CGI to do configuration and retrieve values in the system.
    For each cgi query i see a process is spawned till it returns success/failure to lighttpd. Is there a option in lighttpd.conf to limit the time lighttpd should wait fro this cgi process to return ?

    Thank you .

Leave a Comment