Differences

This shows you the differences between the selected revision and the current version of the page.

howto:lighttpd_php 2016/01/21 05:23 howto:lighttpd_php 2017/09/06 17:34 current
Line 1: Line 1:
-What a plsauere to find someone who thinks through the issues http://sruamwbwz.com [url=http://eerdlmuxqb.com]eerdlmuxqb[/url] [link=http://iybscvrhhl.com]iybscvrhhl[/link]+====== How-to setup Lighttpd and php ====== 
 + 
 +===== Files needed ===== 
 + 
 +  - [[http://dns323.kood.org/downloads/lighttpd-1.4.13.tar.bz2|Lighttpd (recommended)]], [[http://dns323.kood.org/downloads/lighttpd-pcre-1.4.13.tar.bz2|Lighttpd with pcre]] or [[http://dns323.kood.org/downloads/lighttpd-ssl-pcre-1.4.13.tar.bz2|Lighttpd with pcre and ssl]] 
 +  - [[http://dns323.kood.org/downloads/php-4.4.4.tar.bz2|php4 (recommended)]], [[http://dns323.kood.org/downloads/php-5.1.6.tar.bz2|php5]] or [[http://dns323.kood.org/downloads/php-3.0.18-31.tar.bz2|php3 with latest security updates from debian stable]] 
 + 
 +===== Preparation ===== 
 + 
 +  - Make following directory's: 
 +    * ''/mnt/HD_a2/lighttpd/''  - directory binary (lighttpd, php and modules) files. 
 +    *''/mnt/HD_a2/lighttpd/www/'' - directory for files you wish to share. 
 +  - [[:howto:extract|Extract]] Lighttpd and php archive to ''/mnt/HD_a2/lighttpd/'' directory. 
 +  - Optionaly you may want to setup php.ini. Default location for this file is ''/mnt/HD_a2/php.ini''. You can get php.ini from [[http://ee2.php.net/get/php-4.4.4.tar.bz2/from/a/mirror|php.net]]. Also look [[http://ee2.php.net/manual/en/ini.php|manual]] before editing. 
 + 
 +===== Lighttpd configuration ===== 
 + 
 +Following configuration is meant for lighttpd/lighttpd-pcre and php4/php5 
 + 
 +/mnt/HD_a2/lighttpd/lighttpd.conf 
 + 
 +<code>#Set path to folder that has files for website 
 +server.document-root = "/mnt/HD_a2/lighttpd/www/" 
 + 
 +#Set port to run webserver on (not 80) 
 +server.port = 8080 
 + 
 +#Non-default modules needed for css redirect, authentication, server status 
 +server.modules = ( 
 +  "mod_alias", 
 +  "mod_auth", 
 +  "mod_status", 
 +  "mod_fastcgi" 
 +  ) 
 + 
 +#Mimetype assignments 
 +mimetype.assign            = (  
 +  ".pdf"          =>      "application/pdf",  
 +  ".sig"          =>      "application/pgp-signature",  
 +  ".spl"          =>      "application/futuresplash",  
 +  ".class"        =>      "application/octet-stream",  
 +  ".ps"          =>      "application/postscript",  
 +  ".torrent"      =>      "application/x-bittorrent",  
 +  ".dvi"          =>      "application/x-dvi",  
 +  ".gz"          =>      "application/x-gzip",  
 +  ".pac"          =>      "application/x-ns-proxy-autoconfig",  
 +  ".swf"          =>      "application/x-shockwave-flash",  
 +  ".tar.gz"      =>      "application/x-tgz",  
 +  ".tgz"          =>      "application/x-tgz",  
 +  ".tar"          =>      "application/x-tar",  
 +  ".zip"          =>      "application/zip",  
 +  ".mp3"          =>      "audio/mpeg",  
 +  ".m3u"          =>      "audio/x-mpegurl",  
 +  ".wma"          =>      "audio/x-ms-wma",  
 +  ".wax"          =>      "audio/x-ms-wax",  
 +  ".ogg"          =>      "audio/x-wav",  
 +  ".wav"          =>      "audio/x-wav",  
 +  ".gif"          =>      "image/gif",  
 +  ".jpg"          =>      "image/jpeg",  
 +  ".jpeg"        =>      "image/jpeg",  
 +  ".png"          =>      "image/png",  
 +  ".bmp"   =>   "image/bmp", 
 +  ".xbm"          =>      "image/x-xbitmap",  
 +  ".xpm"          =>      "image/x-xpixmap",  
 +  ".xwd"          =>      "image/x-xwindowdump",  
 +  ".css"          =>      "text/css",  
 +  ".html"        =>      "text/html",  
 +  ".htm"          =>      "text/html",  
 +  ".js"          =>      "text/javascript",  
 +  ".asc"          =>      "text/plain",  
 +  ".c"            =>      "text/plain",  
 +  ".conf"        =>      "text/plain",  
 +  ".text"        =>      "text/plain",  
 +  ".txt"          =>      "text/plain",  
 +  ".dtd"          =>      "text/xml",  
 +  ".xml"          =>      "text/xml",  
 +  ".mpeg"        =>      "video/mpeg",  
 +  ".mpg"          =>      "video/mpeg",  
 +  ".mov"          =>      "video/quicktime",  
 +  ".qt"          =>      "video/quicktime",  
 +  ".avi"          =>      "video/x-msvideo",  
 +  ".asf"          =>      "video/x-ms-asf",  
 +  ".asx"          =>      "video/x-ms-asf",  
 +  ".wmv"          =>      "video/x-ms-wmv",  
 +  ".bz2"          =>      "application/x-bzip",  
 +  ".tbz"          =>      "application/x-bzip-compressed-tar",  
 +  ".tar.bz2"      =>      "application/x-bzip-compressed-tar"  
 + )  
 + 
 +#File to load when path only provided, if not found file listing will display instead 
 +index-file.names  = ( "index.htm", "index.html", "index.php", "default.htm" ) 
 +           
 +#Name and path to server error log 
 +server.errorlog  = "/mnt/HD_a2/lighttpd/lighttpd.error.log" 
 + 
 +#Path to css folder 
 +alias.url = ( "/css/" => "/mnt/HD_a2/lighttpd/" ) 
 + 
 +#Enable directory listing and point to custom css file (supply dsm-g600 IP) 
 +server.dir-listing          = "enable" 
 +dir-listing.external-css    = "http://(your.ip.here)/css/lighttpd.css" 
 + 
 +fastcgi.server = ( ".php" => 
 +  (( "host" => "127.0.0.1",  
 +    "port" => 1026, 
 +    "bin-path" => "/mnt/HD_a2/lighttpd/php", 
 +    "min-procs" => 2, 
 +    "max-procs" => 4, 
 +    "max-load-per-proc" => 8, 
 +    "idle-timeout" => 50, 
 +    "broken-scriptfilename" => "enable" 
 +  )) 
 +
 + 
 +#URL to server status page local access only (supply dsm-g600 subnet) 
 +$HTTP["remoteip"] == "192.168.0.0/16" { 
 +  status.status-url = "/server-status" 
 +
 + 
 +#Authentication configuration 
 +#auth.debug                  = 0 
 +#auth.backend                = "plain" 
 +#auth.backend.plain.userfile = "/mnt/HD_a2/lighttpd/lighttpd-plain.user" 
 + 
 +# Set Restrictions: 
 +
 +# ( <left-part-of-the-url> => 
 +#  ( "method" => "digest"/"basic", 
 +#    "realm" => <realm>, 
 +#    "require" => "user=<username>|user=<username>|valid-user" ) 
 +# ) 
 +
 +# <realm> is a string to display in the dialog presented to the user 
 + 
 +#auth.require = ( "/downloads/" => 
 +#                ( 
 +#                  "method"  => "digest", 
 +#                  "realm"  => "DSM-G600 Downloads", 
 +#                  "require" => "valid-user" 
 +#                ) 
 +#              ) 
 +</code> 
 + 
 + 
 +===== Code for fun_plug ===== 
 + 
 +You need to enter following code to your fun_plug file if you wish to start webserver automatically at every time to boot up your DSM-G600. 
 +  /mnt/HD_a2/lighttpd/lighttpd -f /mnt/HD_a2/lighttpd/lighttpd.conf -m /mnt/HD_a2/lighttpd 
 + 
 +===== Links ===== 
 +  * [[http://dns323.kood.org/forum/t24-lighttpd.html|Forum thread]
 +  * [[http://www.lighttpd.net/|Lighttpd]
 +  * [[http://www.php.net/|php]
 +  * [[http://trac.lighttpd.net/trac/wiki/Docs%3ASSL|Lighttpd with ssl]]

Personal Tools