elixiat 发表于 2015-8-30 09:08:28

lighttpd + php 安装配置记录

  博客已经搬家,请访问如下地址:http://www.czhphp.com
  1. 下载 lighttpd , pcre , php , 其他相关扩展包
2. 安装 pcre
    ./configure & make & make install
  
    安装 php
    ./configure --prefix=/usr/local/php/ --with-mysql=/usr/local/mysql --with-gd=/usr/local/gd --with-libxml-dir --with-zlib=/usr/local/zlib --with-curl --with-libxml-dir=/usr/local/libxml --enable-exif --enable-soap --enable-sockets --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/png --with-ttf --with-freetype-dir=/usr/local/freetype --with-ming=/usr/local/libming --enable-sqlite-utf8 --with-xsl=/usr/local/libxslt --enable-zend-multibyte --enable-shared --enable-mbstring --enable-zend-multibyte --with-xmlrpc --enable-fastcgi --enable-force-cgi-redirect   
   
    注意 :
    扩展 --enable-fastcgi --enable-force-cgi-redirect , 会生成 (bin/php-cgi 执行文件)
    不要带--with-apxs2=/usr/local/apache2/bin/apxs (带上后,安装出来的php执行文件是cli模式的)
  # make & make install
   
    安装 lighttpd
   
   ./configure --prefix=/usr/local/lighttpd & make & make install
  3. 创建或复制 lighttpd.conf 启动配置文件
       切换到源码包的根目录/doc
      # cp lighttpd.conf /usr/local/lighttpd/lighttpd.conf   
      
   启动 lighttpd 方法:
      # /usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/lighttpd.conf
  此时安装成功,并可以正常访问了!
  4. 配置为系统服务
      每次启动切换到 /usr/local/lighttpd/sbin 执行 ./lighttpd -f /usr/local/lighttpd/lighttpd.conf 比较麻烦, 而且不方便重新启动!
  切换到源码包的根目录下:
      # cd doc
      # cp sysconfig.lighttpd /etc/sysconfg/lighttpd
      # cat /etc/sysconfg/lighttpd
      
内容如下: LIGHTTPD_CONF_PATH=/etc/lighttpd/lighttpd.conf , 修改到对应的配置文件目录 /usr/local/lighttpd/lighttpd.conf
      # cp rc.lighttpd.redhat /etc/init.d/lighttpd
      # cat /etc/init.d/lighttpd
      
修改 lighttpd="/usr/sbin/lighttpd" 到安装目录 /usr/lcoal/lighttpd/sbin/lighttpd
  希望服务器启动的时候就启动lighttpd:
      # chkconfig lighttpd on
  命令操作: service lighttpd :
  5. 配置lighttpd 支持 php, cgi 等。。。
   
fastcgi.server             = ( ".php" =>
                               ( "localhost" =>
                                 (
                                 "socket" => "/tmp/php-fastcgi.socket",
                                 "bin-path" => "/usr/local/php/bin/php-cgi"
                                 )
                               )
                            )
  6. 安装 spawn-fcgi, 管理fastcgi进程
# ./configure --prefix=/usr/local/spawn-fcgi & make & make install
  
   进入 lighttpd 源码包的根目录下:
   # cd doc
   # cp spawn-php.sh /usr/local/lighttpd/spawn-php.sh
  修改里面的内容
      ## ABSOLUTE path to the spawn-fcgi binary
SPAWNFCGI="/usr/local/lighttpd/bin/spawn-fcgi"
  ## ABSOLUTE path to the PHP binary
FCGIPROGRAM="/usr/local/php/bin/php-cgi"
   
  博客已经搬家,请访问如下地址:http://www.czhphp.com
页: [1]
查看完整版本: lighttpd + php 安装配置记录