{"id":109,"date":"2006-06-27T14:58:00","date_gmt":"2006-06-27T14:58:00","guid":{"rendered":"http:\/\/blog.trungson.com\/?p=109"},"modified":"2006-06-27T14:58:00","modified_gmt":"2006-06-27T14:58:00","slug":"lighttpd-php5-eaccelerator-by-rpms","status":"publish","type":"post","link":"http:\/\/blog.trungson.com\/?p=109","title":{"rendered":"lighttpd, php5, eAccelerator by RPMs"},"content":{"rendered":"<p>Install the require RPMs (php, php-mysql, php-eAccelerator). For Fedora, use yum (lighttpd and lighttpd-fastcgi). For CentOS and other distros that do not include lighttpd in their repository, use <a href=\"http:\/\/dag.wieers.com\/packages\/lighttpd\/\">DAG repository<\/a><\/p>\n<p>\nFind out the path to php-cgi and whether it supports fastcgi (should show cgi-fcgi)<\/p>\n<p><textarea name=\"code\" class=\"xml\"><br \/>\n$ php-cgi -v<br \/>\nPHP 5.0.4 (cgi-fcgi) (built: Nov  8 2005 08:25:54)<br \/>\nCopyright (c) 1997-2004 The PHP Group<br \/>\nZend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies<br \/>\n    with eAccelerator v0.9.4, Copyright (c) 2004-2005 eAccelerator, by eAccelerator<br \/>\n<\/textarea><\/p>\n<p>Configure a light weight lighttpd:<br \/>\n<textarea name=\"code\" class=\"xml\"><br \/>\n# lighttpd configuration file<br \/>\n# @author: Son Nguyen<br \/>\n# @date: 6\/26\/2006<\/p>\n<p>server.modules  = (&#8220;mod_fastcgi&#8221;)<br \/>\nserver.document-root = &#8220;\/home\/www\/&#8221;<br \/>\nserver.max-keep-alive-requests = 0<br \/>\nserver.max-fds  = 2048<br \/>\nserver.port  = 80<\/p>\n<p>server.errorlog  = &#8220;\/var\/log\/lighttpd\/error_log&#8221;<br \/>\nserver.tag  = &#8220;lighttpd&#8221;<br \/>\nserver.username  = &#8220;lighttpd&#8221;<br \/>\nserver.groupname = &#8220;lighttpd&#8221;<br \/>\nserver.pid-file  = &#8220;\/var\/run\/lighttpd.pid&#8221;<\/p>\n<p>#### fastcgi module<br \/>\nfastcgi.server  = (&#8220;.php&#8221;=>(&#8220;localhost&#8221;=>(&#8220;socket&#8221;=>&#8221;\/tmp\/php-fastcgi.socket&#8221;,&#8221;bin-path&#8221;=>&#8221;\/usr\/bin\/php-cgi&#8221;)))<\/p>\n<p># files to check for if &#8230;\/ is requested<br \/>\nindex-file.names = (&#8220;index.php&#8221;,&#8221;index.html&#8221;,&#8221;index.htm&#8221;,&#8221;default.htm&#8221;)<\/p>\n<p># which extensions should not be handle via static-file transfer<br \/>\n# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi<br \/>\nstatic-file.exclude-extensions = ( &#8220;.php&#8221;, &#8220;.pl&#8221;, &#8220;.fcgi&#8221; )<\/p>\n<p># mimetype mapping<br \/>\nmimetype.assign             = (<br \/>\n &#8220;.rpm&#8221;          =>      &#8220;application\/x-rpm&#8221;,<br \/>\n &#8220;.pdf&#8221;          =>      &#8220;application\/pdf&#8221;,<br \/>\n &#8220;.sig&#8221;          =>      &#8220;application\/pgp-signature&#8221;,<br \/>\n &#8220;.spl&#8221;          =>      &#8220;application\/futuresplash&#8221;,<br \/>\n &#8220;.class&#8221;        =>      &#8220;application\/octet-stream&#8221;,<br \/>\n &#8220;.ps&#8221;           =>      &#8220;application\/postscript&#8221;,<br \/>\n &#8220;.torrent&#8221;      =>      &#8220;application\/x-bittorrent&#8221;,<br \/>\n &#8220;.dvi&#8221;          =>      &#8220;application\/x-dvi&#8221;,<br \/>\n &#8220;.gz&#8221;           =>      &#8220;application\/x-gzip&#8221;,<br \/>\n &#8220;.pac&#8221;          =>      &#8220;application\/x-ns-proxy-autoconfig&#8221;,<br \/>\n &#8220;.swf&#8221;          =>      &#8220;application\/x-shockwave-flash&#8221;,<br \/>\n &#8220;.tar.gz&#8221;       =>      &#8220;application\/x-tgz&#8221;,<br \/>\n &#8220;.tgz&#8221;          =>      &#8220;application\/x-tgz&#8221;,<br \/>\n &#8220;.tar&#8221;          =>      &#8220;application\/x-tar&#8221;,<br \/>\n &#8220;.zip&#8221;          =>      &#8220;application\/zip&#8221;,<br \/>\n &#8220;.mp3&#8221;          =>      &#8220;audio\/mpeg&#8221;,<br \/>\n &#8220;.m3u&#8221;          =>      &#8220;audio\/x-mpegurl&#8221;,<br \/>\n &#8220;.wma&#8221;          =>      &#8220;audio\/x-ms-wma&#8221;,<br \/>\n &#8220;.wax&#8221;          =>      &#8220;audio\/x-ms-wax&#8221;,<br \/>\n &#8220;.ogg&#8221;          =>      &#8220;application\/ogg&#8221;,<br \/>\n &#8220;.wav&#8221;          =>      &#8220;audio\/x-wav&#8221;,<br \/>\n &#8220;.gif&#8221;          =>      &#8220;image\/gif&#8221;,<br \/>\n &#8220;.jpg&#8221;          =>      &#8220;image\/jpeg&#8221;,<br \/>\n &#8220;.jpeg&#8221;         =>      &#8220;image\/jpeg&#8221;,<br \/>\n &#8220;.png&#8221;          =>      &#8220;image\/png&#8221;,<br \/>\n &#8220;.xbm&#8221;          =>      &#8220;image\/x-xbitmap&#8221;,<br \/>\n &#8220;.xpm&#8221;          =>      &#8220;image\/x-xpixmap&#8221;,<br \/>\n &#8220;.xwd&#8221;          =>      &#8220;image\/x-xwindowdump&#8221;,<br \/>\n &#8220;.css&#8221;          =>      &#8220;text\/css&#8221;,<br \/>\n &#8220;.html&#8221;         =>      &#8220;text\/html&#8221;,<br \/>\n &#8220;.htm&#8221;          =>      &#8220;text\/html&#8221;,<br \/>\n &#8220;.js&#8221;           =>      &#8220;text\/javascript&#8221;,<br \/>\n &#8220;.asc&#8221;          =>      &#8220;text\/plain&#8221;,<br \/>\n &#8220;.c&#8221;            =>      &#8220;text\/plain&#8221;,<br \/>\n &#8220;.cpp&#8221;          =>      &#8220;text\/plain&#8221;,<br \/>\n &#8220;.log&#8221;          =>      &#8220;text\/plain&#8221;,<br \/>\n &#8220;.conf&#8221;         =>      &#8220;text\/plain&#8221;,<br \/>\n &#8220;.text&#8221;         =>      &#8220;text\/plain&#8221;,<br \/>\n &#8220;.txt&#8221;          =>      &#8220;text\/plain&#8221;,<br \/>\n &#8220;.dtd&#8221;          =>      &#8220;text\/xml&#8221;,<br \/>\n &#8220;.xml&#8221;          =>      &#8220;text\/xml&#8221;,<br \/>\n &#8220;.mpeg&#8221;         =>      &#8220;video\/mpeg&#8221;,<br \/>\n &#8220;.mpg&#8221;          =>      &#8220;video\/mpeg&#8221;,<br \/>\n &#8220;.mov&#8221;          =>      &#8220;video\/quicktime&#8221;,<br \/>\n &#8220;.qt&#8221;           =>      &#8220;video\/quicktime&#8221;,<br \/>\n &#8220;.avi&#8221;          =>      &#8220;video\/x-msvideo&#8221;,<br \/>\n &#8220;.asf&#8221;          =>      &#8220;video\/x-ms-asf&#8221;,<br \/>\n &#8220;.asx&#8221;          =>      &#8220;video\/x-ms-asf&#8221;,<br \/>\n &#8220;.wmv&#8221;          =>      &#8220;video\/x-ms-wmv&#8221;,<br \/>\n &#8220;.bz2&#8221;          =>      &#8220;application\/x-bzip&#8221;,<br \/>\n &#8220;.tbz&#8221;          =>      &#8220;application\/x-bzip-compressed-tar&#8221;,<br \/>\n &#8220;.tar.bz2&#8221;      =>      &#8220;application\/x-bzip-compressed-tar&#8221;<br \/>\n )<br \/>\n<\/textarea><\/p>\n<p>Might need to switch from httpd to lighttpd<\/p>\n<pre>\n# switch from httpd to lighttpd\nservice httpd stop\nservice lighttpd start\nchkconfig --list httpd\nchkconfig lighttpd on\nchkconfig httpd off\nchkconfig --list httpd\nchkconfig --list lighttpd\n<\/pre>\n<p>Can also run both httpd and lighttpd together on the same server (use two different ports, eg: 80 &#038; 81, don&#8217;t forget to open the new port in the firewall) for testing\/benchmarking or development purposes.<\/p>\n<p>Initial benchmark: a 10-15% improvement on serving dynamic PHP\/MySQL pages. Static files are supposed to be much faster. lighttpd is very stable (loadavg is maintained at about 3-4) with higher concurrency levels while Apache might increase loadavg to over 10+<\/p>\n<p>Great kudos to the lighttpd developers for bringing us a fast, light webserver. Fly Light!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install the require RPMs (php, php-mysql, php-eAccelerator). For Fedora, use yum (lighttpd and lighttpd-fastcgi). For CentOS and other distros that do not include lighttpd in their repository, use DAG repository Find out the path to php-cgi and whether it supports fastcgi (should show cgi-fcgi) $ php-cgi -v PHP 5.0.4 (cgi-fcgi) (built: Nov 8 2005 08:25:54) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/109"}],"collection":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=109"}],"version-history":[{"count":0,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/109\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=109"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}