当前位置: 首页 > 工具软件 > Lighttpd > 使用案例 >

5-lighttpd安装

蓝慈
2023-12-01
1、安装 lighttpd
#安装部分依赖
[root@yidaishengjun lighttpd-1.4.64]# yum install -y pcre2-devel
#下载安装包:https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.64.tar.gz
[root@yidaishengjun ~]# wget https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.64.tar.gz --no-check-certificate
#解压安装包:
[root@yidaishengjun ~]# tar -zvxf lighttpd-1.4.64.tar.gz -C /usr/local/
#变更目录:
[root@yidaishengjun ~]# cd /usr/local/
#新建lighttpd目录:
[root@yidaishengjun local]# mkdir -p lighttpd
#移动到代码目录:
[root@yidaishengjun local]# cd lighttpd-1.4.64
#编译:
[root@yidaishengjun lighttpd-1.4.64]# ./configure --prefix=/usr/local/lighttpd
[root@yidaishengjun lighttpd-1.4.64]# make
[root@yidaishengjun lighttpd-1.4.64]# make install
2、配置 lighted
#新建配置文件夹
[root@yidaishengjun lighttpd-1.4.64]# mkdir /usr/local/lighttpd/htdocs
[root@yidaishengjun lighttpd-1.4.64]# mkdir /usr/local/lighttpd/etc
[root@yidaishengjun lighttpd-1.4.64]# cd /usr/local/lighttpd/etc/
[root@yidaishengjun lighttpd-1.4.64]# mkdir /usr/local/lighttpd/log
#新建配置文件:
[root@yidaishengjun lighttpd-1.4.64]# vi /usr/local/lighttpd/etc/lighttpd.conf
#测试配置是否正常:
[root@yidaishengjun lighttpd-1.4.64]# /usr/local/lighttpd/sbin/lighttpd -t -f /usr/local/lighttpd/etc/lighttpd.conf
启动服务:
[root@yidaishengjun lighttpd-1.4.64]# /usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/etc/lighttpd.conf
通过kill -9 $进程 停止服务后重启和更新配置
#/usr/local/lighttpd/etc/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" )
server.errorlog             = "/usr/local/lighttpd/log/lighttpd.error.log"
accesslog.filename          = "/usr/local/lighttpd/log/access.log"                                                                                            
server.document-root = "/usr/local/lighttpd/htdocs/"
server.port = 3000
mimetype.assign = (
  ".html" => "text/html",
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png"
)
static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )
参考:
    
 类似资料: