Difference between revisions of "Lighttpd"

From Q
Jump to navigation Jump to search
 
(One intermediate revision 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 ==
Line 20: Line 20:
 
=== Setting up authentification ===
 
=== Setting up authentification ===
  
{{Box File|/etc/lighttpd/lighttpd.conf|
+
{{File|/etc/lighttpd/lighttpd.conf|
 
<pre>
 
<pre>
 
server.modules = (
 
server.modules = (
Line 39: Line 39:
 
}}
 
}}
  
{{Box File|/var/www/localhost/lighttpd.user|
+
{{File|/var/www/localhost/lighttpd.user|
 
<pre>
 
<pre>
 
admin:xxxxx
 
admin:xxxxx
Line 47: Line 47:
 
=== Enabling CGI Support and rrd file processing ===
 
=== Enabling CGI Support and rrd file processing ===
  
{{Box File|/etc/lighttpd/lighttpd.conf|
+
{{File|/etc/lighttpd/lighttpd.conf|
 
<pre>
 
<pre>
 +
server.modules = (
 +
    "mod_alias",
 +
)
 +
 
# uncomment for cgi support
 
# uncomment for cgi support
 
include "mod_cgi.conf"
 
include "mod_cgi.conf"
Line 54: Line 58:
 
}}
 
}}
  
{{Box File|/etc/lighttpd/mod_cgi.conf|
+
{{File|/etc/lighttpd/mod_cgi.conf|
 
<pre>
 
<pre>
$HTTP["url"] =~ "^/sensord/" {
+
$HTTP["url"] =~ "^/cgi-bin/" {
     dir-listing.activate = "disable"
+
    # disable directory listings
 +
     dir-listing.activate = "enable"
 +
    # only allow cgi's in this directory
 
     cgi.assign = (
 
     cgi.assign = (
 +
                ".pl"  =>      "/usr/bin/perl",
 +
                ".cgi"  =>      "/usr/bin/perl",
 
                 ".rrd"  =>      "/usr/bin/rrdcgi"
 
                 ".rrd"  =>      "/usr/bin/rrdcgi"
 
         )
 
         )
Line 64: Line 72:
 
</pre>
 
</pre>
 
}}
 
}}
 +
 +
{{Root|mkdir -p /var/www/localhost/cgi-bin}}
 +
 +
{{Root|chown -R lighttpd:root /var/www/localhost/cgi-bin}}
  
 
== 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