Chinaunix首页 | 论坛 | 博客
  • 博客访问: 312558
  • 博文数量: 79
  • 博客积分: 3458
  • 博客等级: 中校
  • 技术积分: 921
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 17:09
个人简介

自、管

文章分类

全部博文(79)

文章存档

2013年(7)

2012年(20)

2011年(18)

2010年(34)

分类: LINUX

2011-12-08 09:36:02

预备 SUSELinux9
lighttpd-1.4.20.tar.gz
pcre-7.8.tar.gz
zlib-1.2.3.tar.gz


安装 1、Zlib
1)安装Zlib。
./configure --prefix=/nfs10/aofeng/zlib-1.2.3 --shared
Checking for gcc...
Checking for shared library support...
Building shared library libz.so.1.2.3 with gcc.
Checking for unistd.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for errno.h... Yes.
Checking for mmap support... Yes.

make
gcc -fPIC -O3 -DUSE_MMAP   -c -o example.o example.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o adler32.o adler32.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o compress.o compress.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o crc32.o crc32.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o gzio.o gzio.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o uncompr.o uncompr.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o deflate.o deflate.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o trees.o trees.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o zutil.o zutil.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o inflate.o inflate.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o infback.o infback.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o inftrees.o inftrees.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o inffast.o inffast.c
gcc -shared -Wl,-soname,libz.so.1 -o libz.so.1.2.3 adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
rm -f libz.so libz.so.1
ln -s libz.so.1.2.3 libz.so
ln -s libz.so.1.2.3 libz.so.1
gcc -fPIC -O3 -DUSE_MMAP -o example example.o -L. libz.so.1.2.3
gcc -fPIC -O3 -DUSE_MMAP   -c -o minigzip.o minigzip.c
gcc -fPIC -O3 -DUSE_MMAP -o minigzip minigzip.o -L. libz.so.1.2.3

make check           # 这一步也可以不执行,只是为了校验make是否成功
hello world
zlib version 1.2.3 = 0x1230, compile flags = 0x55
uncompress(): hello, hello!
gzread(): hello, hello!
gzgets() after gzseek:  hello!
inflate(): hello, hello!
large_inflate(): OK
after inflateSync(): hello, hello!
inflate with dictionary: hello, hello!
                *** zlib test OK ***

make install
cp zlib.h zconf.h /nfs10/aofeng/zlib-1.2.3/include
chmod 644 /nfs10/aofeng/zlib-1.2.3/include/zlib.h /nfs10/aofeng/zlib-1.2.3/include/zconf.h
cp libz.so.1.2.3 /nfs10/aofeng/zlib-1.2.3/lib
cd /nfs10/aofeng/zlib-1.2.3/lib; chmod 755 libz.so.1.2.3
cd /nfs10/aofeng/zlib-1.2.3/lib; if test -f libz.so.1.2.3; then \
  rm -f libz.so libz.so.1; \
  ln -s libz.so.1.2.3 libz.so; \
  ln -s libz.so.1.2.3 libz.so.1; \
  (ldconfig || true)  >/dev/null 2>&1; \
fi
cp zlib.3 /nfs10/aofeng/zlib-1.2.3/share/man/man3
chmod 644 /nfs10/aofeng/zlib-1.2.3/share/man/man3/zlib.3

2)查看Zlib安装后生成的文件。
首先进入Zlib安装时用--prefix指定的目录,安装后生成了三个目录:include、lib、share。
ls
include  lib  share

ls -l lib
total 82
lrwxrwxrwx  1 aofeng users    13 2008-12-10 17:14 libz.so -> libz.so.1.2.3
lrwxrwxrwx  1 aofeng users    13 2008-12-10 17:14 libz.so.1 -> libz.so.1.2.3
-rwxr-xr-x  1 aofeng users 81607 2008-12-10 17:14 libz.so.1.2.3

ls -l include
total 75
-rw-r--r--  1 aofeng users  9544 2008-12-10 17:14 zconf.h
-rw-r--r--  1 aofeng users 66188 2008-12-10 17:14 zlib.h

3)将Zlib加入环境变量。
ZLIB_HOME=$USER_HOME/zlib-1.2.3
LD_LIBRARY_PATH=$ZLIB_HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH


2、Pcre
1)安装Pcre。
./configure --prefix=/nfs10/aofeng/pcre-7.8 --enable-utf8 --enable-unicode-properties
…… ……
pcre-7.8 configuration summary:

    Install prefix .................. : /nfs10/nieyong/pcre-7.8
    C preprocessor .................. : gcc -E
    C compiler ...................... : gcc
    C preprocessor ................ : g -E
    C compiler .................... : g
    Linker .......................... : /usr/i586-suse-linux/bin/ld
    C preprocessor flags ............ :
    C compiler flags ................ : -O2
    C compiler flags .............. : -O2
    Linker flags .................... :
    Extra libraries ................. :

    Build C library ............... : yes
    Enable UTF-8 support ............ : yes
    Unicode properties .............. : yes
    Newline char/sequence ........... : lf
    \R matches only ANYCRLF ......... : no
    EBCDIC coding ................... : no
    Rebuild char tables ............. : no
    Use stack recursion ............. : yes
    POSIX mem threshold ............. : 10
    Internal link size .............. : 2
    Match limit ..................... : 10000000
    Match limit recursion ........... : MATCH_LIMIT
    Build shared libs ............... : yes
    Build static libs ............... : yes
    Link pcregrep with libz ......... : no
    Link pcregrep with libbz2 ....... : no
    Link pcretest with libreadline .. : no

make
…… ……

make install
…… ……

2)查看Pcre安装的文件。
首先进入Pcre安装时用--prefix指定的目录,安装后生成了四个目录:bin、include、lib、share。
ls
bin  include  lib  share

ls -l bin
total 79
-rwxr-xr-x  1 aofeng users  1260 2008-12-10 17:32 pcre-config
-rwxr-xr-x  1 aofeng users 31899 2008-12-10 17:32 pcregrep
-rwxr-xr-x  1 aofeng users 45875 2008-12-10 17:32 pcretest

ls -l include
total 65
-rw-r--r--  1 aofeng users  6783 2008-12-10 17:32 pcrecpparg.h
-rw-r--r--  1 aofeng users 26253 2008-12-10 17:32 pcrecpp.h
-rw-r--r--  1 aofeng users 12481 2008-12-10 17:32 pcre.h
-rw-r--r--  1 aofeng users  5029 2008-12-10 17:32 pcreposix.h
-rw-r--r--  1 aofeng users  6600 2008-12-10 17:32 pcre_scanner.h
-rw-r--r--  1 aofeng users  6216 2008-12-10 17:32 pcre_stringpiece.h

ls -l lib
total 555
-rw-r--r--  1 aofeng users 221702 2008-12-10 17:32 libpcre.a
-rw-r--r--  1 aofeng users  35430 2008-12-10 17:32 libpcrecpp.a
-rwxr-xr-x  1 aofeng users    887 2008-12-10 17:32 libpcrecpp.la
lrwxrwxrwx  1 aofeng users     19 2008-12-10 17:32 libpcrecpp.so -> libpcrecpp.so.0.0.0
lrwxrwxrwx  1 aofeng users     19 2008-12-10 17:32 libpcrecpp.so.0 -> libpcrecpp.so.0.0.0
-rwxr-xr-x  1 aofeng users  41344 2008-12-10 17:32 libpcrecpp.so.0.0.0
-rwxr-xr-x  1 aofeng users    805 2008-12-10 17:32 libpcre.la
-rw-r--r--  1 aofeng users   3518 2008-12-10 17:32 libpcreposix.a
-rwxr-xr-x  1 aofeng users    879 2008-12-10 17:32 libpcreposix.la
lrwxrwxrwx  1 aofeng users     21 2008-12-10 17:32 libpcreposix.so -> libpcreposix.so.0.0.0
lrwxrwxrwx  1 aofeng users     21 2008-12-10 17:32 libpcreposix.so.0 -> libpcreposix.so.0.0.0
-rwxr-xr-x  1 aofeng users   9087 2008-12-10 17:32 libpcreposix.so.0.0.0
lrwxrwxrwx  1 aofeng users     16 2008-12-10 17:32 libpcre.so -> libpcre.so.0.0.1
lrwxrwxrwx  1 aofeng users     16 2008-12-10 17:32 libpcre.so.0 -> libpcre.so.0.0.1
-rwxr-xr-x  1 aofeng users 215060 2008-12-10 17:32 libpcre.so.0.0.1
drwxr-xr-x  2 aofeng users    512 2008-12-10 17:32 pkgconfig

3)将pcre加入环境变量。
PCRE_HOME=$USER_HOME/pcre-7.8

PATH=$PCRE_HOME/bin:$PATH
export PATH

LD_LIBRARY_PATH=$PCRE_HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH


3、Lighttpd。
1)安装Lighttpd。
./configure --prefix=/nfs10/nieyong/lighttpd-1.4.20
…… ……
checking for perl regular expressions support... yes
checking for pcre-config... /nfs10/nieyong/pcre-7.8/bin/pcre-config
checking for pcre_compile in -lpcre... yes
checking pcre.h usability... yes
checking pcre.h presence... yes
checking for pcre.h... yes
checking for zlib support... yes
checking for deflate in -lz... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
…… ……

configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating tests/Makefile
config.status: creating tests/docroot/Makefile
config.status: creating tests/docroot/123/Makefile
config.status: creating tests/docroot/www/Makefile
config.status: creating tests/docroot/www/go/Makefile
config.status: creating tests/docroot/www/indexfile/Makefile
config.status: creating tests/docroot/www/expire/Makefile
config.status: creating distribute.sh
config.status: creating cygwin/Makefile
config.status: creating cygwin/lighttpd.README
config.status: creating openwrt/Makefile
config.status: creating openwrt/control
config.status: creating openwrt/lighttpd.mk
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands

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_indexfiles
  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-ipv6
  regex-conditionals
disabled:
  auth-ldap
  network-openssl
  stat-cache-fam
  storage-gdbm
  storage-memcache
  webdav-locks
  webdav-properties

在Linux上安装Lighttpd(LightHttpd) - 傲风 - 傲风的博客注意:如果没有将pcre的bin目录加入环境变量PATH中,在执行这个步骤时将报错:
checking for pcre-config... no
configure: error: pcre-config not found, install the pcre-devel package or build with --without-pcre
并且中断安装。

make
…… ……

make install
…… ……

2)查看Lighttpd安装的文件。
首先进入Lighttpd安装时用--prefix指定的目录,安装后生成了四个目录:bin、lib、sbin、share。
ls
bin  lib  sbin  share

ls -l bin
total 25
-rwxr-xr-x  1 aofeng users 25354 2008-12-11 10:25 spawn-fcgi

ls -l lib
total 1370
-rwxr-xr-x  1 aofeng users   812 2008-12-11 10:25 mod_access.la
-rwxr-xr-x  1 aofeng users   830 2008-12-11 10:25 mod_accesslog.la
-rwxr-xr-x  1 aofeng users 41403 2008-12-11 10:25 mod_accesslog.so
-rwxr-xr-x  1 aofeng users 28020 2008-12-11 10:25 mod_access.so
-rwxr-xr-x  1 aofeng users   806 2008-12-11 10:25 mod_alias.la
-rwxr-xr-x  1 aofeng users 29371 2008-12-11 10:25 mod_alias.so
-rwxr-xr-x  1 aofeng users   808 2008-12-11 10:25 mod_auth.la
-rwxr-xr-x  1 aofeng users 71303 2008-12-11 10:25 mod_auth.so
-rwxr-xr-x  1 aofeng users   794 2008-12-11 10:25 mod_cgi.la
-rwxr-xr-x  1 aofeng users 51968 2008-12-11 10:25 mod_cgi.so
-rwxr-xr-x  1 aofeng users   798 2008-12-11 10:25 mod_cml.la
-rwxr-xr-x  1 aofeng users 42773 2008-12-11 10:25 mod_cml.so
-rwxr-xr-x  1 aofeng users   847 2008-12-11 10:25 mod_compress.la
-rwxr-xr-x  1 aofeng users 45232 2008-12-11 10:25 mod_compress.so
-rwxr-xr-x  1 aofeng users   905 2008-12-11 10:25 mod_dirlisting.la
-rwxr-xr-x  1 aofeng users 49330 2008-12-11 10:25 mod_dirlisting.so
-rwxr-xr-x  1 aofeng users   818 2008-12-11 10:24 mod_evasive.la
-rwxr-xr-x  1 aofeng users 27225 2008-12-11 10:24 mod_evasive.so
-rwxr-xr-x  1 aofeng users   812 2008-12-11 10:25 mod_evhost.la
-rwxr-xr-x  1 aofeng users 31803 2008-12-11 10:25 mod_evhost.so
-rwxr-xr-x  1 aofeng users   812 2008-12-11 10:25 mod_expire.la
-rwxr-xr-x  1 aofeng users 33230 2008-12-11 10:25 mod_expire.so
-rwxr-xr-x  1 aofeng users   836 2008-12-11 10:25 mod_extforward.la
-rwxr-xr-x  1 aofeng users 35990 2008-12-11 10:25 mod_extforward.so
-rwxr-xr-x  1 aofeng users   818 2008-12-11 10:25 mod_fastcgi.la
-rwxr-xr-x  1 aofeng users 98847 2008-12-11 10:25 mod_fastcgi.so
-rwxr-xr-x  1 aofeng users   854 2008-12-11 10:24 mod_flv_streaming.la
-rwxr-xr-x  1 aofeng users 32019 2008-12-11 10:24 mod_flv_streaming.so
-rwxr-xr-x  1 aofeng users   830 2008-12-11 10:25 mod_indexfile.la
-rwxr-xr-x  1 aofeng users 29599 2008-12-11 10:25 mod_indexfile.so
-rwxr-xr-x  1 aofeng users   816 2008-12-11 10:25 mod_magnet.la
-rwxr-xr-x  1 aofeng users 22186 2008-12-11 10:25 mod_magnet.so
-rwxr-xr-x  1 aofeng users   842 2008-12-11 10:25 mod_mysql_vhost.la
-rwxr-xr-x  1 aofeng users 23112 2008-12-11 10:25 mod_mysql_vhost.so
-rwxr-xr-x  1 aofeng users   806 2008-12-11 10:25 mod_proxy.la
-rwxr-xr-x  1 aofeng users 50236 2008-12-11 10:25 mod_proxy.so
-rwxr-xr-x  1 aofeng users   893 2008-12-11 10:25 mod_redirect.la
-rwxr-xr-x  1 aofeng users 31520 2008-12-11 10:25 mod_redirect.so
-rwxr-xr-x  1 aofeng users   887 2008-12-11 10:25 mod_rewrite.la
-rwxr-xr-x  1 aofeng users 35654 2008-12-11 10:25 mod_rewrite.so
-rwxr-xr-x  1 aofeng users   818 2008-12-11 10:25 mod_rrdtool.la
-rwxr-xr-x  1 aofeng users 36012 2008-12-11 10:25 mod_rrdtool.so
-rwxr-xr-x  1 aofeng users   800 2008-12-11 10:25 mod_scgi.la
-rwxr-xr-x  1 aofeng users 77361 2008-12-11 10:25 mod_scgi.so
-rwxr-xr-x  1 aofeng users   842 2008-12-11 10:25 mod_secdownload.la
-rwxr-xr-x  1 aofeng users 30691 2008-12-11 10:25 mod_secdownload.so
-rwxr-xr-x  1 aofeng users   812 2008-12-11 10:25 mod_setenv.la
-rwxr-xr-x  1 aofeng users 29386 2008-12-11 10:25 mod_setenv.so
-rwxr-xr-x  1 aofeng users   848 2008-12-11 10:25 mod_simple_vhost.la
-rwxr-xr-x  1 aofeng users 30789 2008-12-11 10:25 mod_simple_vhost.so
-rwxr-xr-x  1 aofeng users   863 2008-12-11 10:25 mod_ssi.la
-rwxr-xr-x  1 aofeng users 85299 2008-12-11 10:25 mod_ssi.so
-rwxr-xr-x  1 aofeng users   836 2008-12-11 10:25 mod_staticfile.la
-rwxr-xr-x  1 aofeng users 38347 2008-12-11 10:25 mod_staticfile.so
-rwxr-xr-x  1 aofeng users   812 2008-12-11 10:25 mod_status.la
-rwxr-xr-x  1 aofeng users 46027 2008-12-11 10:25 mod_status.so
-rwxr-xr-x  1 aofeng users   923 2008-12-11 10:25 mod_trigger_b4_dl.la
-rwxr-xr-x  1 aofeng users 29875 2008-12-11 10:25 mod_trigger_b4_dl.so
-rwxr-xr-x  1 aofeng users   818 2008-12-11 10:25 mod_userdir.la
-rwxr-xr-x  1 aofeng users 32006 2008-12-11 10:25 mod_userdir.so
-rwxr-xr-x  1 aofeng users   830 2008-12-11 10:25 mod_usertrack.la
-rwxr-xr-x  1 aofeng users 31338 2008-12-11 10:25 mod_usertrack.so
-rwxr-xr-x  1 aofeng users   812 2008-12-11 10:25 mod_webdav.la
-rwxr-xr-x  1 aofeng users 60180 2008-12-11 10:25 mod_webdav.so

ls -l sbin
total 591
-rwxr-xr-x  1 aofeng users 573917 2008-12-11 10:25 lighttpd
-rwxr-xr-x  1 aofeng users  14657 2008-12-11 10:25 lighttpd-angel


验证 1)显示Lighttpd的版本信息。
进入sbin目录。
./lighttpd -v
lighttpd-1.4.20 - a light and fast webserver
Build-Date: Dec 11 2008 10:18:59

2)显示编译特性。
./lighttpd -V
lighttpd-1.4.20 - a light and fast webserver
Build-Date: Dec 11 2008 10:18:59

Event Handlers:

        select (generic)
        poll (Unix)
        rt-signals (Linux 2.4 )
        epoll (Linux 2.6)
        - /dev/poll (Solaris)
        - kqueue (FreeBSD)

Network handler:

        sendfile

Features:

        IPv6 support
        zlib support
        bzip2 support
        crypt support
        - SSL Support
        PCRE support
        - mySQL support
        - LDAP support
        - memcached support
        - FAM support
        - LUA support
        - xml support
        - SQLite support
        - GDBM support

3)拷贝配置文件。
为了便于管理,在lighttpd的安装目录下新建一个目录:config,专门用于存放配置文件。
将配置文件lighttpd.conf从lighttpd的安装源文件的doc目录下复制到config目录下。

4)建立应用根目录。
仿JAVA的WEB容器,在lighttpd的安装目录下建立一个目录:webapps,作为lighttpd的默认应用根目录。
修改配置文件:
server.document-root        = "/srv/www/htdocs/"
将“=”后面的值修改成实际的路径,这里是$LIGHTTPD_HOME/webapps。

5)建立日志目录。
在lighttpd的安装目录下建立一个目录:logs,作为存放lighttpd存放日志的目录。
修改配置文件:
server.errorlog             = "/var/log/lighttpd/error.log"
accesslog.filename       = "/var/log/lighttpd/access.log"

6)检查Lighttpd的配置文件。
./lighttpd -t -f /nfs10/aofeng/lighttpd-1.4.20/config/lighttpd.conf
Syntax OK

7)启动Lighttpd。
./lighttpd -f /nfs10/nieyong/lighttpd-1.4.20/config/lighttpd.conf

8)打开浏览器,输入URL,界面如下(这是我自定义的一个主页):
在Linux上安装Lighttpd(LightHttpd) - 傲风 - 傲风的博客
阅读(5549) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~