Table of Contents

Install and configure lighttpd

Installing a lighttpd webserver without root access

This is not dificult but if a local version of Perl is also being used, it may be tricky to get the local version of Perl modules to run (See Install additional modules locally without root access)

This is an example of a lighttpd.conf file that works for me (serving Perl pages from the locally installed Perl)

# ============================================================================================================
# see full config example at
# https://redmine.lighttpd.net/projects/lighttpd/repository/14/revisions/master/entry/doc/config/lighttpd.conf
# ============================================================================================================

var.root = "<your home directory>"
var.log_root = root + "/lighttpd/log"
var.doc_root = root + "/dbahawk_server"

setenv.add-environment = ("PERL5LIB" => root + "/perl5/lib/perl5")

server.modules = (
    "mod_access",
    "mod_cgi",
    "mod_alias",
    "mod_accesslog",
    "mod_compress",
    "mod_redirect"
)
# this assigns the local Perl but does not catch the local value of PERL5LIB, so... cgi.assign    = ( ".pl"  => root + "/opt/perl/bin/perl",
cgi.assign    = ( ".pl"  => root + "/opt/perl/bin/execperl.ksh",
                  ".py"  => "/usr/bin/python"
)

server.document-root = doc_root + "/html"
server.port          = 3000
server.errorlog      = log_root + "/error.log"
#server.pid-file      = "lighttpd.pid"
#server.username      = "u024124"
#server.groupname     = "cln"
#server.port          = 3000

mimetype.assign = (
    ".html" => "text/html",
    ".txt" => "text/plain",
    ".jpg" => "image/jpeg",
    ".css" => "text/css",
    ".png" => "image/png"
)

index-file.names               = ( "index.php", "index.html", "index.pl" )
#static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
alias.url                     += ( "/cgi-bin" => doc_root + "/cgi-bin/" )
url.access-deny                = ( "~", ".inc" )



#auth.backend = "plain"
#auth.backend.plain.userfile = "/etc/lighttpd/.lighttpdpwd"

#auth.require = ( "/var/www" =>
#(
#.method. => "basic",
#.realm. => "Authentication required",
#.require. => "user=admin"
#)
#)

where execperl.ksh looks like this

#!/usr/bin/env ksh
export PERL5LIB="${HOME}/opt/perl:${PERL5LIB}"
export PATH="${HOME}/opt/perl/bin:${PATH}"
exec perl

Use the new version of Perl

vi $HOME/.bashrc
export PERL5LIB="/home/users/u024124/perl5/lib/perl5"
export PATH="${HOME}/opt/perl/bin:${PATH}"

Syntax check the webserver config

cd /home/users/u024124/lighttpd/sbin
./lighttpd -tf ../etc/lighttpd.conf

Start the webserver

./lighttpd -Df ../etc/lighttpd.conf >/dev/null 2>&1 &

Bootstrap