码迷,mamicode.com
首页 > 其他好文 > 详细

lighttpd 编译安装

时间:2014-05-20 23:29:06      阅读:313      评论:0      收藏:0      [点我收藏+]

标签:lighttpd 编译安装

1,下载安装lighttpd-1.4.34
lighttpd官网下载最新稳定版本
[root@localhost software]#tar -zxvf lighttpd-1.4.34.tar.gz
[root@localhost software]#cd lighttpd-1.4.34
[root@localhost lighttpd-1.4.34]#./configure --prefix=/usr/local/lighttpd  #安装默认模块
[root@localhost lighttpd-1.4.34]#make && make install

2,添加lighttp运行用户
[root@localhost lighttpd-1.4.34]#useradd  -M -s /sbin/nologin  lighttpd


3,拷贝配置文件模板
[root@localhost lighttpd-1.4.34]# cd doc/
[root@localhost doc]# ls
config  initscripts  lighttpd.8  Makefile  Makefile.am  Makefile.in  newstyle.css  oldstyle.css  outdated  scripts  systemd
[root@localhost doc]# cp -r config /usr/local/lighttpd/
然后删除正式安装目录下的Makefile文件
[root@localhost config]# rm -rf Makefile*


4,拷贝服务启动脚本文件并添加自启动
[root@localhost initscripts]# pwd
/root/software/lighttpd-1.4.34/doc/initscripts
[root@localhost initscripts]# cp rc.lighttpd.RedHat  /etc/init.d/lighttpd
[root@localhost initscripts]# chkconfig lighttpd on
[root@localhost initscripts]# chmod u+x /etc/init.d/lighttpd

5,修改启动脚本文件中的配置路径 ,如下
if [ -z "$LIGHTTPD_CONF_PATH" ]; then
       LIGHTTPD_CONF_PATH="/usr/local/lighttpd/config/lighttpd.conf"  #定义配置文件目录
fi
lighttpd="/usr/local/lighttpd/sbin/lighttpd" #定义主程序命令位置

6,修改主配置lighttpd.conf文件
var.home_dir    = "/usr/local/lighttpd"  #定义程序主目录
var.server_root = "/home/html" #定义web应用主目录
var.log_root    = home_dir+"/var/log" #定义日志目录
var.state_dir   = home_dir+"/var/run" #定义运行状态文件目录
var.conf_dir    = home_dir+"/etc" #定义配置文件目录
var.vhosts_dir  = server_root + "/vhosts" #定义虚拟主机配置目录
var.cache_dir   = home_dir+"/var/cache" #定义缓存目录
var.socket_dir  = home_dir + "/sockets" #定义socket文件目录
include "modules.conf" #加载系统模块配置文件
server.port = 8080 #系统监听端口
server.use-ipv6 = "disable"
server.username  = "lighttpd" #运行用户身份
server.groupname = "lighttpd" #运行组身份
server.document-root = server_root #定义web应用目录
server.pid-file = state_dir + "/lighttpd.pid"
server.errorlog = log_root + "/error.log"
include "conf.d/access_log.conf"
include "conf.d/debug.conf"
server.event-handler = "linux-sysepoll"
server.network-backend = "linux-sendfile"
server.max-fds = 2048
server.stat-cache-engine = "simple"
server.max-connections = 1024
index-file.names += (
 "index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
)
url.access-deny             = ( "~", ".inc" )
$HTTP["url"] =~ "\.pdf$" {
 server.range-requests = "disable"
}
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
include "conf.d/mime.conf"
include "conf.d/dirlisting.conf"
server.follow-symlink = "enable"
server.upload-dirs = ( "/tmp" )


7,启动相应模块及其主文件配置
模块配置文件
[root@localhost etc]# cat modules.conf |grep -v ^# | grep -v ^$
server.modules = (
 "mod_access",
 "mod_rewrite", #启用重定向
)
include "conf.d/proxy.conf" #启用代理模块
include "conf.d/secdownload.conf" #启动secdownload防盗链模块
include "conf.d/fastcgi.conf" #启用fastcgi模块


代理配置主文件
[root@localhost etc]# cat conf.d/proxy.conf |grep -v ^# | grep -v ^$
server.modules += ( "mod_proxy" )


proxy.server = ( ".php" =>
                ( "nginx" =>
                  (
                    "host" => "127.0.0.1",
                    "port" => 80
                  )
                ),
".mp3"=>
                ( "nginx" =>
                  (
                    "host" => "127.0.0.1",
                    "port" => 80
                  )
                )
              )


secdownload防盗链模块配置主文件
[root@localhost etc]# cat conf.d/secdownload.conf |grep -v ^# | grep -v ^$
server.modules += ( "mod_secdownload" )
secdownload.document-root = server_root + "/music"
secdownload.secret = "Tgn.com"
secdownload.timeout = 60
secdownload.uri-prefix = "/mp3/"

本文出自 “冬暖夏凉” 博客,请务必保留此出处http://pencild.blog.51cto.com/3947107/1414091

lighttpd 编译安装,布布扣,bubuko.com

lighttpd 编译安装

标签:lighttpd 编译安装

原文地址:http://pencild.blog.51cto.com/3947107/1414091

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!