轉載鏈接:https://wiki.freebsdchina.org/howto/n/php_fastcgi_lighttpd
安裝lighttpd
記得在SPAWNFCGI前打勾
[X] SPAWNFCGI Depend on spawn-fcgi utility #cd /usr/ports/www/lighttpd #make config #make install clean
安裝php
模塊自己看自己需要
#cd /usr/ports/lang/php5/ && make install clean #cd /usr/ports/lang/php5-extensions/ && make install clean
配置lighttpd
編輯/usr/local/etc/lighttpd/lighttpd.conf,添加以下內容:
server.modules += ( "mod_fastcgi" ) fastcgi.server = ( ".php" =>(( "socket" => "/tmp/php-fastcgi.socket","bin-path" => "/usr/local/bin/php-cgi","min-procs" => 1,"max-procs" => 1,"max-load-per-proc" => 4,"bin-environment" => ("PHP_FCGI_CHILDREN" => "2",#"PHP_FCGI_CHILDREN" => "64",//這里進程數自己看著辦"PHP_FCGI_MAX_REQUESTS" => "10000" ),"bin-copy-environment" => ("PATH", "SHELL", "USER" ),"broken-scriptfilename" => "enable","idle-timeout" => 20)) )
設置服務
啟動lighttpd
#echo 'lighttpd_enable="YES"' >> /etc/rc.conf #/usr/local/etc/rc.d/lighttpd start
網站跟目錄是修改這行
server.document-root = "/usr/local/www/data/"