Thursday, May 29, 2008

Differences between lighttpd and apache.

Below is some of the basic differences between lighttpd and apache.

Basic configuration

Apache:

DocumentRoot /var/www/html
CustomLog /var/www/logs/access
ErrorLog /var/www/logs/error
User www
Group www

lighttpd:

server.document-root = “/var/www/html”
accesslog.filename = “/var/www/logs/access”
server.errorlog = “/var/www/logs/error”
server.username = “www”
server.groupname = “www”
server.modules = ( “mod_accesslog” )

Authentication and Authorization .htaccess

Apache:
AuthName “My Special Directory”
AuthType Basic
AuthUserFile /var/www/passwords/users
Order deny,allow
require valid-user

lighttpd:

auth.backend = “htpasswd”
auth.backend.htpasswd.userfile = “/var/www/passwords/users”
auth.require = ( “/special/” =>
(
“method” => “basic”,
“realm” => “My Special Directory”,
“require” => “valid-user”
)
)

Virtual Host configuration

Apache:

NameVirtualHost *

ServerName “scratch.example.com”
DocumentRoot “/var/www/hosts/scratch/docs”

ServerName “sniff.example.com”
DocumentRoot “/var/www/hosts/sniff/docs”

lighttpd:

$HTTP["host"] == “scratch.example.com” {
server.document-root = “/var/www/hosts/scratch/docs/” }
$HTTP["host"] == “sniff.example.com” {
server.document-root = “/var/www/hosts/sniff/docs/” }

Virtual Host Modules:

Apache:

LoadModule vhost_alias_module modules/mod_vhost_alias.so
VirtualDocumentRoot /var/www/hosts/%1/docs

lighttpd:

server.modules = ( …, “mod_evhost”, … )
evhost.path-pattern = “/var/www/hosts/%3/docs”

PHP

Apache:

LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php

lighttpd:

server.modules = ( …, “mod_fastcgi”, … )
fastcgi.server =
( “.php” =>
( “localhost” =>
(
“socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/usr/local/bin/php”
)
)
)

No comments: