[[ https://www.lighttpd.net/ | Lighttpd Home ]] Ref: https://www.howtoforge.com/tutorial/install-lighttpd-with-php-fpm-and-mysql-on-debian/ ====== Installation ====== * apt-get install lighttpd * Modify /etc/lighttpd/lighttpd.conf * set server.document-root to "/home/usr/www", and "sudo chown www-data:www-data /home/usr/www" * start it sudo /etc/init.d/lighttpd start * Test it by browser "http://rabi.chem.purdue.edu" * Modify /etc/passwd #www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin www-data:x:33:33:www-data:/home/usr/www:/bin/bash * Note that required packages: pcre (for compiling only) * Follow the instruction in https://www.howtoforge.com/tutorial/install-lighttpd-with-php-fpm-and-mysql-on-debian/ * Note: 1) keep only two lines in fastcgi.server's body as shown; 2) apt-get install php5-mysqlnd php5-xcache; 3) to reload we can type either "/etc/init.d/xxx restart" or "systemctl restart xxx.service" ====== Setup php to work with lighttpd ====== * [[http://slackbuilds.org/repository/12.1/network/lighttpd/ | ref]] * Install php from slackpkg * Uncomment "include conf.d/fastcgi.conf" in /etc/lighttpd/modules.conf. * In the fastcgi section of /etc/lighttpd/lighttpd.conf, copy the following lines below the extisting commented out fastcgi config. fastcgi.server = ( ".php" => ( "localhost" => ( "socket" => "/tmp/php-fastcgi.socket", "bin-path" => "/usr/bin/php-cgi -c /etc/lighttpd/php.ini" ) ) ) * Change the group of /var/lib/php from "apache" to "nobody". Otherwise php won't be able to use $_SESSION. * Test it by browser "http://rabi.chem.purdue.edu/test.php". If it does not work, make sure first you can run php from command line. * Note that required packages: libmcrypt, sqlite, net-snmp, t1lib ====== The following was copied from doku site ====== ====== Lighttpd ====== [[:DokuWiki]] will run just fine with [[http://www.lighttpd.net|Lighttpd]] and PHP through FastCGI. - create ''/etc/dokuwiki/lighttpd.conf'' - ''cd /etc/lighttpd/conf-available'' - ''ln /etc/dokuwiki/lighttpd.conf 50-dokuwiki.conf'' - /etc/lighttpd/conf-available/50-dokuwiki.conf -> /etc/dokuwiki/lighttpd.conf - enable config with ''lighttpd-enable-mod dokuwiki'' - ''/etc/init.d/lighttpd force-reload'' ===== /etc/dokuwiki/lighttpd.conf ===== alias.url += ("/dokuwiki" => "/usr/share/dokuwiki") $HTTP["url"] =~ "^/dokuwiki" { server.follow-symlink = "enable" } $HTTP["url"] =~ "/(\.|_)ht" { url.access-deny = ( "" ) } $HTTP["url"] =~ "^/dokuwiki/(bin|data|inc|conf)" { url.access-deny = ( "" ) } * See [[:security#deny_directory_access_in_lighttpd]] * See [[:rewrite#lighttpd|rewriting]] for how to set up rewrite rules for clean URLs with lighty. ====== A better version ====== # DokuWiki configuration # We assume here that the wiki is accessible via http://wiki.example.com/dokuwiki/ var.dokudir = "/dokuwiki" # make sure those are always served through FastCGI and never as static files static-file.exclude-extensions = ( ".php" ) # deny access completely to these $HTTP["url"] =~ "/(\.|_)ht" { url.access-deny = ( "" ) } $HTTP["url"] =~ "^" + var.dokudir + "/(bin|data|inc|conf)/" { url.access-deny = ( "" ) } # rewrites for dokuwiki $HTTP["url"] =~ "^" + var.dokudir { index-file.names = ("doku.php") } url.rewrite-once = ( "^" + var.dokudir + "/lib/.*$" => "$0", "^" + var.dokudir + "/_media/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1&$2", "^" + var.dokudir + "/_media/(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1", "^" + var.dokudir + "/_detail/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/detail.php?media=$1&$2", "^" + var.dokudir + "/_detail/(.*)?$" => var.dokudir + "/lib/exe/detail.php?media=$1", "^" + var.dokudir + "/_export/([^/]+)/(.*)\?(.*)$" => var.dokudir + "/doku.php?do=export_$1&id=$2&$3", "^" + var.dokudir + "/_export/([^/]+)/(.*)" => var.dokudir + "/doku.php?do=export_$1&id=$2", "^" + var.dokudir + "/doku.php.*" => "$0", "^" + var.dokudir + "/feed.php.*" => "$0", "^" + var.dokudir + "/(.*)\?(.*)" => var.dokudir + "/doku.php?id=$1&$2", "^" + var.dokudir + "/(.*)" => var.dokudir + "/doku.php?id=$1" )