1. lighttpd
由于CentOS官方的源中没有Lighttpd包,因此需要手动导入RPMforge源。
请根据自己系统的情况选择如下32/64位、CentOS 5/CentOS 6操作系统的源并安装好,具体请浏览 http://pkgs.repoforge.org/rpmforge-release/ 选择合适的rpm安装包。
# wget -c http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm # rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
2.lighttpd-fastcgi
#yum install lighttpd-fastcgi php-cli #chkconfig --levels 235 lighttpd on //start on boot.
4、配置Lighttpd与PHP5
将Lighttpd配置为fastCGI模式,只需要修改三个配置文件,并且比较简单。
1、打开 /etc/php.ini 文件
1 |
vi /etc/php.ini |
在php.ini文件最后加如下一行语句并保存:
cgi.fix_pathinfo = 1
2、打开 /etc/lighttpd/modules.conf 文件:
1 |
vi /etc/lighttpd/modules.conf |
将 include “conf.d/fastcgi.conf” 一行取消注释并保存,如下图:
3、打开/etc/lighttpd/conf.d/fastcgi.conf 文件:
1 |
vi/etc/lighttpd/conf.d/fastcgi.conf |
找到 fastcgi.server这一节配置段,并将其全部反注释(使之生效),并修改为如下(注意红色为修改部分):
fastcgi.server = ( “.php” =>
( “php-local” =>
(
“socket” => “/tmp/php-fastcgi-1.socket“,
“bin-path” => “/usr/bin/php-cgi“,
“max-procs” => 1,
“broken-scriptfilename” => “enable”,
)
),
( “php-tcp” =>
(
“host” => “127.0.0.1″,
“port” => 9999,
“check-local” => “disable”,
“broken-scriptfilename” => “enable”,
)
),( “php-num-procs” =>
(
“socket” => “/tmp/php-fastcgi-2.socket“,
“bin-path” => “/usr/bin/php-cgi“,
“bin-environment” => (
“PHP_FCGI_CHILDREN” => “16″,
“PHP_FCGI_MAX_REQUESTS” => “10000″,
),
“max-procs” => 5,
“broken-scriptfilename” => “enable”,
)
),
)
最后保存即可。
现在可以重启Lighttpd使之生效:
1 |
[root@www ~] # /etc/init.d/lighttpd restart |
最新评论