ITeye博客

lighttpd 安装配置

yanwenhan · 2007-12-19 17:20 · Lighttpd · Markdown

【Lighttpd 安装配置】

首先需要安装: libpcre libz

官方网址:http://www.lighttpd.net

cd /usr/local/src

wget http://www.lighttpd.net/download/lighttpd-1.4.18.tar.gz

tar -zxvf lighttpd-1.4.18.tar.gz

cd lighttpd-1.4.18

./configure --prefix=/usr/local/lighttpd

make

make install

cd /usr/local/lighttpd

mkdir conf

cp /usr/local/src/lighttpd-1.4.18/doc/lighttpd.conf /usr/local/lighttpd/conf/

vi /usr/local/lighttpd/conf/lighttpd.conf

=============================================== server.modules = ( "mod_rewrite", "mod_redirect", "mod_alias", "mod_access",

"mod_cml",

"mod_trigger_b4_dl",

"mod_auth",

"mod_status",

"mod_setenv",

"mod_fastcgi",

"mod_proxy",

                           "mod_simple_vhost",

"mod_evhost",

"mod_userdir",

"mod_cgi",

                           "mod_compress",
                           "mod_ssi",

"mod_usertrack",

                           "mod_expire",

"mod_secdownload",

"mod_rrdtool",

                            "mod_accesslog" )

mimetype.assign = ( ... ".rm" => "audio/x-pn-realaudio", ... ".smi" => "application/smil", ".smil" => "application/smil", ... )

ssi.extension = ( ".shtml" )

accesslog.filename = "/dev/null" accesslog.format = "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i""

$HTTP == "home.cn.real.com" { accesslog.filename = "/real/WebSite/logs/backup/access_log.home" }

$HTTP =~ ".js|.css|.jpg|.gif|.swf|/artistinfo/|/status/|.png|.ico|/player/|/radio/sid/" { accesslog.filename = "/dev/null" }

dir-listing.activate = "disable"

server.document-root = "/real/WebSite/htdocs/home.cn.real.com/" server.errorlog = "/usr/local/lighttpd/log/error.log" index-file.names = ( "index.html", "index.htm") server.pid-file = "/usr/local/lighttpd/log/lighttpd.pid"

simple-vhost.server-root = "/real/WebSite/htdocs/" simple-vhost.default-host = "home.cn.real.com" simple-vhost.document-root = "/"

compress.cache-dir = "/real/WebSite/cache/compress/" compress.filetype = ("text/plain", "text/html")

#Performance server.max-keep-alive-requests = 2000 server.max-keep-alive-idle = 10 server.max-read-idle = 60 server.max-write-idle = 360 server.event-handler = "poll" server.max-fds = 2048

===============================================

cp /usr/local/src/lighttpd-1.4.18/doc/rc.lighttpd.redhat /usr/local/lighttpd/bin/lighttpd.sh

vi /usr/local/lighttpd/bin/lighttpd.sh

===============================================

LIGHTTPD_CONF_PATH="/usr/local/lighttpd/conf/lighttpd.conf"

lighttpd="/usr/local/lighttpd/sbin/lighttpd"

===============================================

启动lighttpd 服务器

/usr/local/lighttpd/bin/lighttpd.sh start

(或者使用 # /usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/conf/lighttpd.conf )

Installing services ? Lighttpd is meant to run a in background as daemon. You can either use the well known init-scripts or supervise to control it.

init scripts ? The init-script that is shipped with the source-tarball is meant to be run on a LSB conforming platform like SuSE, Fedora or Debian.

$ sed -e 's/FOO/lighttpd/g' doc/rc.lighttpd > /etc/init.d/lighttpd $ chmod a+rx /etc/init.d/lighttpd $ cp -p doc/sysconfig.lighttpd /etc/sysconfig/lighttpd $ install -Dp ./doc/lighttpd.conf /etc/lighttpd/lighttpd.conf $ chkconfig lighttpd on If you're running CentOS (or RHEL) you might need to change the first line to this

$ sed -e 's/FOO/lighttpd/g' doc/rc.lighttpd.redhat > /etc/init.d/lighttpd In Debian\Ubuntu you use update-rc.d rather than chkconfig:

$ sudo update-rc.d lighttpd defaults

【安装php (fast-cgi)】 安装 mysql 安装 libxml2-2.6.30.tar.gz

./configure
--prefix=/usr/local/php5-fcgi
--with-config-file-path=/etc
--with-mysql=/usr/local/mysql
--with-gd
--with-jpeg-dir
--with-zlib-dir
--with-png-dir
--with-freetype-dir
--with-curl
--with-libxml-dir=/usr/local
--enable-fastcgi
--enable-force-cgi-redirect
--enable-soap
--enable-sockets
--enable-ftp
--disable-debug

vi /etc/php.ini

=============================================== cgi.fix_pathinfo=1

spawn-php.sh 是把 PHP with FastCGI 的环境变量初始化 (还不清楚如何使用,先不启动spawn-php.sh)

cp /usr/local/src/lighttpd-1.4.18/doc/spawn-php.sh /usr/local/lighttpd/bin/

vi /usr/local/lighttpd/bin/spawn-php.sh

===============================================

SPAWNFCGI="/usr/local/lighttpd/bin/spawn-fcgi"

FCGIPROGRAM="/usr/local/php5-fcgi/bin/php"

USERID=root

GROUPID=root

===============================================

/usr/local/lighttpd/bin/spawn-php.sh

=============================================== 防盗链接配置

server.modules = ( ... "mod_secdownload", "mod_flv_streaming", ... )

flv-streaming.extensions = (".flv") secdownload.secret = "2008" secdownload.document-root = "/real/WebSite/videos/flv/" secdownload.uri-prefix = "/dl/" secdownload.timeout = 120

===============================================

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。