现在的位置: 首页 > 综合 > 正文

Lighttpd安装及配置

2013年05月13日 ⁄ 综合 ⁄ 共 1674字 ⁄ 字号 评论关闭

Linux发行版本:Fedora 14 i686

Lighttpd源码包:lighttpd-1.4.32.tar.gz

1、安装Lighttpd依赖软件。

      FIXME

2、解压缩源码包并安装软件

      # tar -zxf lighttpd-1.4.32.tar.gz

      # cd lighttpd-1.4.32

      # ./configure --prefix=/usr/local/lighttpd-1.4.32    注:--prefix指定安装路径,默认为[/usr/local]

      # make

      # make install

3、编写配置文件

      # mkdir /etc/lighttpd

      # vim lighttpd.conf

      内容如下:

# 路径:/etc/lighttpd/lighttpd.conf

########## 基本配置 ##########
# 加载模块
server.modules = ("mod_accesslog", "mod_fastcgi")
# 基本变量
var.server_root = "/var/www/lighttpd"
var.log_root    = "/var/log/lighttpd"
# 服务器根路径
server.document-root = server_root
# 服务器监听端口
server.port = 80
# 服务器日志路径
server.errorlog = log_root + "/error.log"
accesslog.filename = log_root + "/access.log"
# 主页文件
index-file.names += (
    "index.html", "index.php"
)

########## 常用配置 ##########
# 运行用户及用户组,启动用户须有root权限
server.username  = "lighttpd"
server.groupname = "lighttpd"

########## CGI配置 ##########
fastcgi.server = ( ".php" =>    # 文件扩展。Lighttpd内部提供FastCGI加载均衡
                   ( "php-local" =>     # 可选。用于mod_status统计,指示处理该文件扩展的后台处理器
                     (
#                       "socket" => "/var/run/php-fastcgi-1.socket",    # FIXME 实现
                       "host" => "127.0.0.1",   # 指定socket或者host+port。
                       "port" => 9999,
                       "bin-path" => "/usr/bin/php-cgi",    # 如果本地FastCGI没有运行,该路径本地FastCGI将被启动
                     )
                   ),
                )

FIXME

4、添加Lighttpd命令到PATH和sudo环境

      添加Lighttpd命令道PATH很简单,不再赘述。

      使用visudo命令或者直接编辑/etc/sudoers,把Lighttpd的bin路径加入到secure_path,如下所示:

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/lib/lighttpd-1.4.32/sbin    注:secure_path是sudo的PATH环境

5、运行Lighttpd

      # lighttpd -f /etc/lighttpd/lighttpd.conf -m /usr/local/lighttpd-1.4.32/lib    注:-m指定模块路径,默认为[/usr/local/lib]

 

抱歉!评论已关闭.