lighttpd 安装配置
首先需要安装:
libpcre
libz
可从http://lighttpd.net/download/下载最新的源码(.tar.gz)或者rpm包。如果下载的是.tar.gz文件,则和GNU的其他软件一样,先./configure一下,然后 make && make install就搞定了。但是如果你想定制一些功能,就得好好看看解压后README, INSTALL以及./configure --help的输出结果了。这里仅仅说一下如何从源码安装,其他安装方式可参考 http://trac.lighttpd.net/trac/wiki/TutorialInstallation。
$ gzip -cd lighttpd-1.4.9.tar.gz | tar xf - ... $ cd lighttpd-1.4.9 $ ./configure --help `configure' configures lighttpd 1.4.9 to adapt to many kinds of systems. Usage: ./configure [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: ... Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, `make install' will install all the files in `/usr/local/bin', `/usr/local/lib' etc. You can specify an installation prefix other than `/usr/local' using `--prefix', for instance `--prefix=$HOME'. For better control, use the options below. Fine tuning of the installation directories: ... Program names: ... System types: ... Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-static[=PKGS] build static libraries [default=no] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-lfs Turn on Large File System (default) --disable-ipv6 disable IPv6 support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] --with-mysql[=PATH] Include MySQL support. PATH is the path to 'mysql_config' --with-ldap enable LDAP support --with-attr enable extended attribute support --with-valgrind enable internal support for valgrind --with-openssl[=DIR] Include openssl support (default no) --with-openssl-includes=DIR OpenSSL includes --with-openssl-libs=DIR OpenSSL libraries --with-kerberos5 use Kerberos5 support with OpenSSL --with-pcre Enable pcre support (default yes) --with-bzip2 Enable bzip2 support for mod_compress --with-fam fam/gamin for reducing number of stat() calls --with-webdav-props properties in mod_webdav --with-gdbm gdbm storage for mod_trigger_b4_dl --with-memcache memcached storage for mod_trigger_b4_dl --with-lua lua engine for mod_cml Some influential environment variables: ...
如上所述,可通过--prefix指定安装路径,默认安装在/usr/local下。可以指定启用哪些特征(插件),禁用哪些特征(插件)。假定我们要把lighttpd安装到/usr/local/lighttpd-1.4.9下面。
$ ./configure --prefix=/usr/local/lighttpd-1.4.9 $ make $ make install $ cp doc/lighttpd.conf /usr/local/lighttpd-1.4.9/ # 拷贝配置文件 $ cd /usr/local/lighttpd-1.4.9 $ vi lighttpd.conf # 修改配置文件
配置文件很直观明了,一般只要把server.document-root、server.errorlog、accesslog.filename改成你的实际目录和文件名字就可以了。
$ sbin/lighttpd -f lighttpd.conf # 启动lighttpd服务 $ ps aux | grep lighttpd www 15403 0.0 0.9 2860 1148 ? S 00:15 0:00 sbin/lighttpd -f
这就完成了从安装到启动的整个过程,很简单吧。从最后一行的输出可以看出,lighttpd是单进程服务的,这和apache不一样(也许是它的稳定性不如apache的一个原因)。