FreeBSD下安装lighttpd支持php

FreeBSD下安装lighttpd支持php

有不恰当的地方欢迎指正By:ghw(gehaowu@gmail.com)

安装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/"

原文链接:http://wiki.freebsdchina.org/howto/n/php_fastcgi_lighttpd

发表评论

电子邮件地址不会被公开。 必填项已用*标注