如何在centos下编译安装lighttpd

安装必要的软件

  1. yum -y install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel
  2. yum -y install gamin
  3. yum -y install gamin-devel
  4. yum -y install gcc gcc-c++

安装Lighttpd

http://www.lighttpd.net/下载最新版,现在最新版是1.4.28。

  1. cd /usr/local/src
  2. wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.28.tar.gz
  3. tar -zxvf lighttpd-1.4.28.tar.gz
  4. cd lighttpd-1.4.28
  5. make clean && make distclean
  6. ./configure --with-fam
  7. make
  8. make install

配置Lighttpd

  1. sed -e 's/FOO/lighttpd/g' doc/rc.lighttpd.redhat > /etc/init.d/lighttpd
  2. chmod 755 /etc/init.d/lighttpd
  3. echo "LIGHTTPD_CONF_PATH=/etc/lighttpd/lighttpd.conf" > /etc/sysconfig/lighttpd
  4. install -Dp ./doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
  5. chkconfig lighttpd on

创建符号链接

  1. ln -s /usr/local/sbin/lighttpd /usr/sbin/lighttpd

为Lighttpd建立用户和用户组

  1. groupadd lighttpd
  2. adduser -m -g lighttpd -d /var/www -s /sbin/nologin lighttpd

为Lighttpd建立文件夹和设置所有权

  1. mkdir /var/log/lighttpd
  2. chown lighttpd:lighttpd /var/log/lighttpd

修改配置文件

  1. vi /etc/lighttpd/lighttpd.conf

启动Lighttpd

  1. service lighttpd start

设置根目录文件夹

  1. server.document-root        = "/srv/www/htdocs/"

设置用户名和组

  1. perl -i -p -e 's/#server.username            = "wwwrun"/server.username            = "lighttpd"/g;' /etc/lighttpd/lighttpd.conf
  2. perl -i -p -e 's/#server.groupname           = "wwwrun"/server.groupname           = "lighttpd"/g;' /etc/lighttpd/lighttpd.conf

设置pid文件

  1. server.pid-file            = "/var/run/lighttpd.pid"



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值