phpfastcgi+lighttpd的安装

[不指定 2010/06/08 07:28 | by admin ]
| |
lighttpd的安装
1、先安装mysql
2、安装php,php的编译参数加上 --enable-fastcgi --enable-force-cgi-redirect
3、安装lighttpd
   a、安装pcre
        tar zxvf pcre-7.9.tar.gz
        cd pcre-7.9/
        ./configure
        make
        make install
        cd ../
    b、安装lighttpd
        tar xzvf lighttpd-1.4.26.tar.gz
        cd lighttpd-1.4.26
        ./configure --prefix=/web/lighttpd
        make
        make install

mkdir /etc/lighttpd
cp doc/lighttpd.conf /etc/lighttpd/
cp doc/sysconfig.lighttpd /etc/sysconfig/lighttpd
cp doc/rc.lighttpd.redhat /etc/init.d/lighttpd

vi /etc/init.d/lighttpd
lighttpd="/usr/sbin/lighttpd修改为lighttpd="/web/lighttpd/sbin/lighttpd" 改为你的lighttpd的安装路径
vi /etc/lighttpd/lighttpd.conf  修改配置文件

打开需要的模块,去掉前面的# ( "mod_rewrite",  "mod_alias", "mod_access", "mod_fastcgi",  "mod_cgi",   "mod_compress", "mod_accesslog" )

server.document-root        = "/srv/www/htdocs/"   修改为自己的路径
如:
server.document-root        = /home/wwwroot/htdocs

#server.pid-file            = "/var/run/lighttpd.pid"   打开这一句
#server.username            = "wwwrun"   改成自己的用户
#server.groupname           = "wwwrun"    改成自己的用户组
如自己加一个
groupadd wwwrun
useradd wwwrun -g wwwrun -d /home/wwwroot/htdocs -s /sbin/nologin

查找下面的:
#fastcgi.server             = ( ".php" =>
#                               ( "localhost" =>
#                                 (
#                                   "socket" => "/var/run/lighttpd/php-f        astcgi.socket",
#                                   "bin-path" => "/usr/local/bin/php-cg        i"
#                                 )
#                               )
#                            )
打开
#cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
#                               ".cgi" => "/usr/bin/perl" )
打开

mkdir -p /var/run/lighttpd/
chown -R www.www /var/run/lighttpd/
chmod -R 777 /var/run/lighttpd/
mkdir -p /var/log/lighttpd/
chmod -R 777 /var/log/lighttpd/
上面一段较重要,否则会启动不了lighttpd

chkconfig --add lighttpd
chkconfig lighttpd on
service lighttpd start

在/home/wwwroot/htdocs里建个phpinfo.php进行测试
phpinfo();
?>
电脑类 | 评论(0) | 引用(0) | 阅读(426)