FrequentlyAskedQuestions » History » Version 50

Version 49 (hoffie, 2007-04-08 14:26) → Version 50/73 (Anonymous, 2007-05-27 21:13)

= FAQs =

[[PageOutline(2-3,Frequently Asked Questions,inline)]]

== Where to get help? ==

IRC: [ freenode], channel [irc:// #lighttpd]

Mailing list: [ details], [ archive].

== General ==

=== How do I bind to more than one address? ===

Use server.bind and server.port to bind to the first port and then the $SERVER!["socket"] conditional to bind to the rest (it will 'magically' bind to the specified socket).

server.port = 80
server.bind = ""

$SERVER["socket"] == "" {
status.status-url = "/server-status"

This can also be combined with [ SSL].

=== What kind of environment does server.error-handler-404 set up? ===


* QUERY_STRING is ''not'' set, so you have to parse the REQUEST_URI yourself to get it.
* Likewise, PATH_INFO isn't set.
* SCRIPT_NAME is set according to the handler, not according to the original URI.

=== Why is server.error-handler-404 serving 200 instead of 404? ===

Quote from Jan:
For further information read the server.errorfile-prefix entry [wiki:Docs:Configuration in configuration info].

=== How do I protect a directory with a password? ===

Look in the doc/authentication.txt


See also [wiki:HowToAuthenticationFromMultipleFiles]

=== Can I use Apache Modules with lighttpd? ===

No, apache modules are not compatible with lighttpd.

=== Can I use SVN over WebDAV with lighttpd? ===

No, use apache. If you would like, you can proxy requests to apache through lighttpd.

=== What is lighttpd's equivalent to Apache's "Options +!MultiViews"? +!MultiViews" ? ===

See [wiki:MigratingFromApache#MultiViews] [wiki:Docs:ModMagnet#extention-rewrites]

== FastCGI ==

=== Where is the spawn-php program/script available from? it's mentioned in docs but not available in the distributed package (1.3.7) ===

If you install lighttpd (, the spawn-fcgi binary is installed automatically (to /usr/bin/spawn-fcgi by default).

The script can be found here:

=== Is there an su-exec wrapper available? ===

Not officially, but Sune Foldager coded one especially for lighttpd which you can grab [ here]. It's very easy to use, but has not yet been extensively tested so a little caution is advised. On the other hand, the source is very small so it's easy to get a security overview. Instructions and usage examples (with lighttpd) are in the [ README].

=== How do I exclude a certain directory from FastCGI? ===

fastcgi.server = ( "/" => ... )


=== I get the error "No input file specified" when trying to use PHP ===

See the comments in the [ PHP docs]. The issue here is that the environment variable SCRIPT_FILENAME is not being passed to PHP.

Double check that you have this line in your php.ini:

If you are running via spawn-fcgi, you might also want to check you are running as a user/group that can read the fast cgi scripts. If this is not the case you will also get the "No input file specified" message.

=== How many php CGI processes will lighttpd spawn? ===


* PHP_FCGI_CHILDREN (defaults to 8 before 4.3.0, 0 after; see below)
* min-procs (default 4)
* max-procs (default 4)

When lighttpd starts, it will launch min-procs parent php processes. Each parent process then pre-forks PHP_FCGI_CHILDREN child processes. For example, if min- and max-procs are 4 and PHP_FCGI_CHILDREN is 16, lighttpd will start 4 + 4 x 16 = 68 processes.

To disable lighttpd's process control, set min-procs and max-procs to 1 and set PHP_FCGI_CHILDREN to the number of processes you want to spawn.

In the case of lighttpd 1.4, php 4.3, and eAccelerator 0.9.3 on Linux, eAccelerator will create a separate memory space for each parent process. If you leave min- and max-procs at 4, you'll end up with four separate eAccelerator caches. However, if a php parent segfaults, you'll still have three groups available to respond to queries. For this reason, Jan recommends setting min- and max-procs to 2.

After PHP 4.3.0, PHP_FCGI_CHILDREN defaults to 0. If left at 0, PHP will not pre-fork any children, so only min-procs parents will handle requests.

PHP 5 seems to start one parent process and one child per min/max-procs and PHP_FCGI_CHILDREN defaults to 1. What I suggest is splitting the number of processes you want between min/max-procs and PHP_FCGI_CHILDREN. The number of processes spawned = min/max-procs*(PHP_FCGI_CHILDREN+1). For my setup, I have min-procs and max-procs=2 and PHP_FCGI_CHILDREN=4.


=== What does %1/$1 mean? ===

It's just "lighty speak" for [ backreferences]. (See doc/rewrite.txt and doc/redirect.txt.)

%n is used to denote a backreference on the conditional, and $n is used to backreference on the redirect/rewrite regex. If you need to learn about regexen, [] is as good a place to start as any.

=== What does "(server.c.XXX) connection closed - write-request-timeout: YY" in my error log mean? ===


=== Why: 'unexpected end-of-file (perhaps the fastcgi process died)'? or random '500 - Internal Server Error' ===
If you are using fastcgi with PHP then this may be caused by using PHP extensions that are unstable. For example the following configuration caused my lighttpd install to respond sometimes to indentical queries with '500 - Internal Server Error' and sometimes with the page requested. The issue was fixed by removing the APD 'extension' line in the relevant PHP configuration file.

== SSL ==
=== Microsoft Internet Explorer reports "bad data from server" when surfing an SSL-enabled Lighttpd site ===

The current solution (equivalent of using !SetEnvIf in Apache) is using the following configuration snippet:
server.max-keep-alive-requests = 0

== MacOSX ==
=== Lighttpd crashes when using server.event-handler="poll" in MacOSX ===
Configure lighttpd to use kqueue as the event-handler:

server.event-handler = "freebsd-kqueue"

See Also: [wiki:server.event-handlerDetails server.event-handler option]