Difference between revisions of "Lighttpd"

From Q
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
  
 
== Packages ==
 
== Packages ==
{{Box Code|emerge lighttpd -pv|
+
{{Code|emerge lighttpd -pv|
 
<pre>
 
<pre>
 
[ebuild  N    ] www-servers/lighttpd-1.4.23  USE="bzip2 gdbm ipv6 pcre ssl -doc -fam -fastcgi -ldap -lua -memcache -minimal -mysql -php -rrdtool -test -webdav -xattr" 627 kB
 
[ebuild  N    ] www-servers/lighttpd-1.4.23  USE="bzip2 gdbm ipv6 pcre ssl -doc -fam -fastcgi -ldap -lua -memcache -minimal -mysql -php -rrdtool -test -webdav -xattr" 627 kB
Line 14: Line 14:
  
 
== Installation ==
 
== Installation ==
{{Codeline|# emerge lighttpd}}
+
{{Root|emerge lighttpd}}
  
 
== Configuration ==
 
== Configuration ==
{{Box File|/etc/lighttpd/lighttpd.conf|
+
 
 +
=== Setting up authentification ===
 +
 
 +
{{File|/etc/lighttpd/lighttpd.conf|
 
<pre>
 
<pre>
 
server.modules = (
 
server.modules = (
 
     "mod_auth",
 
     "mod_auth",
 
)
 
)
 
# uncomment for cgi support
 
include "mod_cgi.conf"
 
  
 
auth.backend              = "plain"
 
auth.backend              = "plain"
Line 39: Line 39:
 
}}
 
}}
  
{{Box File|/etc/lighttpd/mod_cgi.conf|
+
{{File|/var/www/localhost/lighttpd.user|
 
<pre>
 
<pre>
$HTTP["url"] =~ "^/statistics/" {
+
admin:xxxxx
     dir-listing.activate = "disable"
+
</pre>
 +
}}
 +
 
 +
=== Enabling CGI Support and rrd file processing ===
 +
 
 +
{{File|/etc/lighttpd/lighttpd.conf|
 +
<pre>
 +
server.modules = (
 +
    "mod_alias",
 +
)
 +
 
 +
# uncomment for cgi support
 +
include "mod_cgi.conf"
 +
</pre>
 +
}}
 +
 
 +
{{File|/etc/lighttpd/mod_cgi.conf|
 +
<pre>
 +
$HTTP["url"] =~ "^/cgi-bin/" {
 +
    # disable directory listings
 +
     dir-listing.activate = "enable"
 +
    # only allow cgi's in this directory
 
     cgi.assign = (
 
     cgi.assign = (
                 ".rrd"  =>      "/usr/bin/perl"
+
                ".pl"  =>      "/usr/bin/perl",
 +
                ".cgi"  =>      "/usr/bin/perl",
 +
                 ".rrd"  =>      "/usr/bin/rrdcgi"
 
         )
 
         )
 
}
 
}
Line 50: Line 73:
 
}}
 
}}
  
{{Box File|/var/www/localhost/lighttpd.user|
+
{{Root|mkdir -p /var/www/localhost/cgi-bin}}
<pre>
+
 
admin:xxxxx
+
{{Root|chown -R lighttpd:root /var/www/localhost/cgi-bin}}
</pre>
 
}}
 
  
 
== Finalize ==
 
== Finalize ==
{{Codeline|# /etc/init.d/lighttpd start}}
+
{{Root|/etc/init.d/lighttpd start}}
  
{{Codeline|# rc-update add lighttpd default}}
+
{{Root|rc-update add lighttpd default}}

Latest revision as of 16:14, 27 July 2011

Description

Lightwight alternative to the allmighty Apache.

Dependencies

USE-Flags

Packages

Code: emerge lighttpd -pv
[ebuild  N    ] www-servers/lighttpd-1.4.23  USE="bzip2 gdbm ipv6 pcre ssl -doc -fam -fastcgi -ldap -lua -memcache -minimal -mysql -php -rrdtool -test -webdav -xattr" 627 kB

Installation

# emerge lighttpd

Configuration

Setting up authentification

File: /etc/lighttpd/lighttpd.conf
server.modules = (
    "mod_auth",
)

auth.backend               = "plain"
auth.backend.plain.userfile = "/var/www/localhost/lighttpd.user"

auth.require               = ( "/" =>
                              (
                                "method"  => "basic",
                                "realm"   => "Restricted Area",
                                "require" => "user=admin"
                              )
                             )
File: /var/www/localhost/lighttpd.user
admin:xxxxx

Enabling CGI Support and rrd file processing

File: /etc/lighttpd/lighttpd.conf
server.modules = (
    "mod_alias",
)

# uncomment for cgi support
include "mod_cgi.conf"
File: /etc/lighttpd/mod_cgi.conf
$HTTP["url"] =~ "^/cgi-bin/" {
    # disable directory listings
    dir-listing.activate = "enable"
    # only allow cgi's in this directory
    cgi.assign = (
                ".pl"   =>      "/usr/bin/perl",
                ".cgi"  =>      "/usr/bin/perl",
                ".rrd"  =>      "/usr/bin/rrdcgi"
        )
}
# mkdir -p /var/www/localhost/cgi-bin
# chown -R lighttpd:root /var/www/localhost/cgi-bin

Finalize

# /etc/init.d/lighttpd start
# rc-update add lighttpd default