如何在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"



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章