首页 > 服务器 > CentOS下lighttpd整合PHP安装手顺
2013
11-07

CentOS下lighttpd整合PHP安装手顺

lighttpd 整合php 安装手顺
安装所需编译模块
yum install gcc glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel zlib-devel
glib2-devel : Gnome header files for version 2 of the GLib library
openssl-devel – Used by core and SSL support
pcre-devel – Used by mod_redirect, mod_rewrite,
bzip2-devel – Use by compress-bzip2
zlib-devel – Used by compress-gzip and compress-deflate. It contains the header files and libraries.
下载
wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.28.tar.gz
解压
tar zxvf lighttpd-1.4.28.tar.gz
进入安装目录
cd lighttpd-1.4.28
配置
./configure –prefix=/usr/local/lighttpd
编译与安装
make && make install
拷贝启动脚本
sed ‘s#/usr/sbin/lighttpd#/usr/local/lighttpd/sbin/lighttpd#’ doc/initscripts/rc.lighttpd.redhat >/etc/init.d/lighttpd
修改启动脚本中的lighttpd的安装位置
vi /etc/init.d/lighttpd
lighttpd=”/usr/sbin/lighttpd” -> lighttpd=”/usr/local/lighttpd/sbin/lighttpd”
增加脚本的执行权限
chmod a+rx /etc/init.d/lighttpd
创建默认配置文件
cp -p doc/initscripts/sysconfig.lighttpd /etc/sysconfig/lighttpd
拷贝配置文件
mkdir -p /etc/lighttpd
cp -R doc/config/conf.d/ doc/config/*.conf doc/config/vhosts.d/ /etc/lighttpd/
添加到开机自动启动服务
chkconfig lighttpd on
修改配置文件
vi /etc/lighttpd/lighttpd.conf
var.server_root = “/srv/www”  =>  var.server_root = “/home/wwwroot”
server.use-ipv6 = “enable”  =>  server.use-ipv6 = “disable”
运行前的准备
增加lighttpd组与用户
groupadd lighttpd
useradd -g lighttpd -s /sbin/nologin -d /dev/null lighttpd
# 分配权限
chown -R lighttpd:lighttpd /usr/local/lighttpd
chown root:root /etc/rc.d/init.d/lighttpd
chmod 755 /etc/rc.d/init.d/lighttpd
# 创建日志目录
mkdir -p /var/log/lighttpd
chown -R lighttpd:lighttpd /var/log/lighttpd
# 创建网站根目录
mkdir -p  /home/wwwroot/htdocs
chown -R lighttpd:lighttpd /home/wwwroot/
# 支持php
vi /etc/lighttpd/modules.conf
#include “conf.d/fastcgi.conf”去掉前面的注释
vi /etc/lighttpd/conf.d/fastcgi.conf 添加以下内容
fastcgi.server = ( “.php” =>
( “localhost” =>
(
“socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/usr/local/php/bin/php-cgi”
)
)
)
# 启动服务
service lighttpd start

最后编辑:
作者:dean
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。