`
yanwenhan
  • 浏览: 115378 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

lighttpd 安装配置

阅读更多
【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["host"] == "home.cn.real.com" {
    accesslog.filename          = "/real/WebSite/logs/backup/access_log.home"
}


$HTTP["url"] =~ "\.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


<?php
$secret = "2008";
$uri_prefix = "/dl/";

# filename
$f = "/test.flv";

# current timestamp
$t = time();
$t_hex = sprintf("%08x", $t);

$m = md5($secret.$f.$t_hex);

printf('<a href="%s%s/%s%s">%s</a>',
       $uri_prefix, $m, $t_hex, $f, $f);
?>

===============================================
分享到:
评论

相关推荐

    lighttpd配置和启动脚本

    包括lighttpd.conf配置文件以及用于控制web server启动和停止的脚本。

    Linux Lighttpd 配置安装 运行 测试

    在Linux上安装Lighttpd,里面有遇到的一些问题的解决方法,整个安装流程,还有参考网站

    varnish+lighttpd配置

    varnish+lighttpd配置

    lighttpd简单配置

    lighttpd简单配置,希望对新手同志有用!!!

    用于ROR应用的lighttpd配置模板

    里面包含了lighttpd启动程序,lighttpd配置模板以及一个控制lighttpd启动和关闭的脚本。

    lighttpd-1.4.55移植配置与测试.rar

    交叉编译最新版的lighttpd-1.4.55,配置与测试CGI与HTML.内含 lighttpd-1.4.55源码,移植教程,cgi测试代码,html测试代码.测试cgi时,浏览器中应该输入192.168.100.30/cgi-bin/xx.cgi .其中 192.168.100.30为开发板的ip

    lighttpd性能优化

    lighttpd轻量级的HTTP服务器,全面支持fast-cgi

    lighttpd.conf注释

    lighttpd.conf,可以直接使用。带注释。网上搜索的资料,自己加的。可能有人觉得没什么用╮(╯_╰)╭。分享

    简明Windows,lighttpd,fastcgi,php5 Web服务器配置

    NULL 博文链接:https://yeahoo.iteye.com/blog/319066

    CentOS下Lighttpd Web服务器安装与配置方法

    OS: CentOS release 5.5 Lighttpd: 1.4.28 安装 sudo yum install lighttpd.i386 lighttpd-fastcgi.i386 lighttpd-mod_mysql_vhost.i386 运行 检查配置文件 lighttpd -t -f lighttpd.conf 启动lighttpd服务 ...

    Lighttpd源码分析_mobi

    主要内容包括:lighttpd介绍与分析准备工作、lighttpd网络服务主模型、lighttpd数据结构、伸展树、日志系统、文件状态缓存器、配置信息加载、i/o多路复用技术模型、插件链、网络请求服务响应流程、请求响应数据快速...

    phpLight(LightTPD+PHP集成包) v2014

    纯绿色,安装后无需再配置。支持系统服务和非服务两种启动方式,自由切换。一次性安装无需再安装,即使重做系统后亦可使用,直接点启动即可。小巧简易迷你只有14M,非常方便的搭建网站服务器。有专门开发的控制面板...

    ubuntu lighttpd实现websocket

    3、首先配置lighttpd.conf 修改为自己的工作路径 var.server_root = "/home/caoft/lighttpd/lighttpd_websocket/http_server" var.state_dir = "/home/caoft/lighttpd/lighttpd_websocket/http_server" var.home_dir...

    docker镜像构建,中间件mysql、lighttpd、Nginx、squid配置和启动、dubbo服务部署

    学习心得,分享出来供大家学习。docker镜像构建,中间件mysql、lighttpd、Nginx、squid配置和启动、dubbo服务部署

    lighttpd源码分析

    网上收集的关于lighttpd代码分析的文章,内容不多。

    LightTPD for windows 1.4.45-x86

    startLighttp.vbs 为一键启动lighttpd和php-cgi的启动脚本,php使用fastcgi host:port形式 test_cgi.cmd 为测试cgi传参数用(如果发现php程序返回No input file specified.说明server.document-root这个目录配置的有...

    LightTPD for windows 1.4.45-x64

    startLighttp.vbs 为一键启动lighttpd和php-cgi的启动脚本,php使用fastcgi host:port形式 test_cgi.cmd 为测试cgi传参数用(如果发现php程序返回No input file specified.说明server.document-root这个目录配置的有...

    三大WEB服务器配置文档

    APACHE服务器安装配置(LAMP) LIGHTTPD服务器安装配置 LIGHTTPD服务状态监控 NGINX服务器安装配置

Global site tag (gtag.js) - Google Analytics