lfjigu 发表于 2018-12-20 08:45:18

lighttpd解析php请求

  1)下载,解压


[*]#wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.28.tar.bz2
[*]#tar xf lighttpd-1.4.28.tar.bz2

  2)编译安装


[*]# ./configure --prefix=/usr/local/lighttpd \
[*]            --enable-lfs               \
[*]            --disable-ipv6               \
[*]            --with-openssl               \
[*]            --with-pcre                  \      
[*]            --with-zlib                  \   
[*]            --with-bzip2

  错误提示


[*]checking for openssl/ssl.h... yes
[*]checking for BIO_f_base64 in -lcrypto... yes
[*]checking for SSL_new in -lssl... yes
[*]checking for perl regular expressions support... yes
[*]checking for pcre-config... no
[*]configure: error: pcre-config not found, install the pcre-devel package or build with --without-pcre

  安装pcre-devel


[*]# yum list |grep pcre-devel
[*]pcre-devel.i386                            6.6-6.el5_6.1               updates
[*]pcre-devel.x86_64                        6.6-6.el5_6.1               updates
[*]
[*]yum install -y pcre-devel.x86_64

  再次./configure


[*]Plugins:
[*]
[*]enabled:
[*]mod_access
[*]mod_accesslog
[*]mod_alias
[*]mod_auth
[*]mod_cgi
[*]mod_compress
[*]mod_dirlisting
[*]mod_evhost
[*]mod_expire
[*]mod_extforward
[*]mod_fastcgi
[*]mod_flv_streaming
[*]mod_indexfile
[*]mod_proxy
[*]mod_redirect
[*]mod_rewrite
[*]mod_rrdtool
[*]mod_scgi
[*]mod_secdownload
[*]mod_setenv
[*]mod_simple_vhost
[*]mod_ssi
[*]mod_staticfile
[*]mod_status
[*]mod_trigger_b4_dl
[*]mod_userdir
[*]mod_usertrack
[*]mod_webdav
[*]disabled:
[*]mod_cml
[*]mod_magnet
[*]mod_mysql_vhost
[*]
[*]Features:
[*]
[*]enabled:
[*]auth-crypt
[*]compress-bzip2
[*]compress-deflate
[*]compress-gzip
[*]large-files
[*]network-openssl
[*]regex-conditionals
[*]disabled:
[*]auth-ldap
[*]network-ipv6
[*]stat-cache-fam
[*]storage-gdbm
[*]storage-memcache
[*]webdav-locks
[*]webdav-properties

  出现上面的提示即OK,紧接着


[*]# make && make install && make clean

  3)准备工作
  copy配置文件以及创建工作目录


[*]# mkdir /etc/lighttpd
[*]# cp -R doc/config/conf.d/ doc/config/*.conf doc/config/vhosts.d/ /etc/lighttpd/

  删除掉一些没用的东东


[*]# cd /etc/lighttpd/vhosts.d/ (and /etc/lighttpd/conf.d)
[*]# rm -rf Makefile*

  创建默认配置文件


[*]# cd doc/initscripts/
[*]# cp sysconfig.lighttpd /etc/sysconfig/lighttpd

  复制启动脚本


[*]# cd doc/initscripts/
[*]# cp rc.lighttpd.redhat /etc/init.d/lighttpd
[*]# chkconfig --add lighttpd
[*]# chkconfig lighttpd on

  这个脚本要更改一处东东,29行处修改成如下


[*]lighttpd="/usr/local/lighttpd/sbin/lighttpd"

  或者将/usr/local/lighttpd/sbin/lighttpd文件copy一份至/usr/sbin下亦可。
  4)修改主配置文件lighttpd.conf


[*]var.log_root    = "/var/log/lighttpd"
[*]var.server_root = "/var/www"
[*]var.state_dir   = "/var/run"
[*]var.home_dir    = "/var/lib/lighttpd"
[*]var.conf_dir    = "/etc/lighttpd"
[*]
[*]server.use-ipv6 = "disable"
[*]
[*]server.username= "www"
[*]server.groupname = "www"
[*]
[*]server.document-root = server_root

  创建日志目录


[*]# mkdir /var/log/lighttpd
[*]# chown -R www.www /var/log/lighttpd/

  网站目录


[*]# mkdir /var/www
[*]# chown -R www.www /var/www

  编译modules.conf


[*]server.modules = (
[*]"mod_access",
[*]"mod_fastcgi"
[*]#"mod_alias",
[*]#"mod_auth",
[*]#"mod_evasive",
[*]#"mod_redirect",
[*]#"mod_rewrite",
[*]#"mod_setenv",
[*]#"mod_usertrack",
[*])

  打开fastcgi功能


[*]##
[*]## FastCGI (mod_fastcgi)
[*]##
[*]include "conf.d/fastcgi.conf"

  再编译fastcgi.conf


[*]fastcgi.server = (
[*]".php" => ((
[*]    "host" => "127.0.0.1",
[*]    "port" => "9000",
[*]    "docroot" => "/var/www"
[*])))

  检查语法错误


[*]/usr/local/lighttpd/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf
[*]Syntax OK

  启动


[*]# /etc/init.d/lighttpd start




页: [1]
查看完整版本: lighttpd解析php请求