在ubuntu11.04 下源码安装 lighttpd + php

开始:先下载安装proc:http://www.pcre.org/

下载当前最新版:pcre-8.12.zip

mv pcre-8.12.zip /opt
sudo unzip pcre-8.12.zip
cd pcre-8.12
sudo ./configure
sudo make 
sudo  make install

安装bzip2库

sudo apt-get install libbz2-dev

安装libzip库

sudo apt-get install libzip-dev

下载lighttpd当前最新版:http://www.lighttpd.net lib

sudo 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
sudo ./configure --prefix=/usr/local/lighttpd
sudo make 
sudo make install

到此为止lighttpd安装完毕。

测试lighttpd运行情况

编辑lighttpd.conf,在/var/www/lighttd/test/下放一个简单的html:index.html

server.document-root = "/var/www/lighttpd/test"

server.port = 8011

mimetype.assign = (
  ".html" => "text/html",
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png"
)

index-file.names = ( "index.html" )
运行lighttpd
cd /usr/local/lighttpd
sudo ln -s sbin/lighttpd /usr/local/sbin/lighttpd
lighttpd -f lighttpd.conf
netstat -ntlp 查看有无8011的端口,有则算是成功了。

安装php5:http://www.php.net 

下载5.3.6

sudo tar -zxvf php-5.3.6.tar.gz
cd  php-5.3.6
sudo ./configure --prefix=/usr/local/php5
sudo make
sudo make install

下班,明天接着做...

今天接着试验。

编辑lighttpd.conf

server.document-root = "/var/www/lighttpd/test"

server.port = 8011

mimetype.assign = (
  ".html" => "text/html",
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png"
)

index-file.names = ( "index.html" )

static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )

server.modules         = (
                    "mod_rewrite",
                    "mod_redirect",
                    "mod_access",
                    "mod_fastcgi",
                    "mod_compress",
                    "mod_accesslog" )

fastcgi.server = ( ".php" =>
  ( "localhost" =>
    (
      "socket" => "/tmp/php-fastcgi.socket",
      "bin-path" => "/usr/local/php5/bin/php-cgi"
    )
   )
)
启动lighttpd
cd /usr/local/lighttpd
lighttpd -f lighttpd.conf

到此为止PHP+Lighttpd的环境配置完毕


参考:http://www.cnblogs.com/czh-liyu/archive/2010/03/23/1692587.html

你可能感兴趣的:(PHP,socket,ubuntu,lighttpd,Access,redirect)