web 服务器lighttpd的交叉编译及配置

一:下载源码

        下载lighttpd-1.4.54.tar.gz和pcre-8.43.tar.gz

        下载连接:lighttpd1.4.54源码及依赖库prce8.43源码资源-CSDN文库

二:交叉编译prce

        cd ~/work/pcre/

        mkdir _install

        tar zxvf pcre-8.43.tar.gz

        cd  pcre-8.43/

         ./configure --prefix=/home/hfzuo/work/pcre/_install --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc

        注意替换自己的安装目录及工具链

        make

        make install

三:交叉编译lighttpd

        cd ~/work/lighttpd/

        mkdir _install

        tar zxf lighttpd-1.4.54.tar.gz

        cd lighttpd-1.4.54/    

        ./configure --prefix=/home/hfzuo/work/_install/ --host=aarch64-linux-gnu --without-zlib --without-bzip2 PCRE_LIB=/home/hfzuo/work/pcre/_install/lib/libpcre.a CPPFLAGS=-I/home/hfzuo/work/pcre/_install/include CC=aarch64-linux-gnu-gcc

        make

        make install

四:配置lighttpd 服务

        在~/work/lighttpd/_install中创建目录cache、cgi-bin、config、log、sockets、upload、vhosts、webpages,并将源码包中doc/config目录下的conf.d目录、lighttpd.conf和modules.conf复制到lighttpd.install/config

        cd ~/work/lighttpd/_instal

        mkdir -p cache cgi-bin config log sockets upload vhosts webpages

        cp -rf ~/work/lighttpd/lighttpd-1.4.54/doc/config/conf.d ~/work/lighttpd/lighttpd-1.4.54/doc/config/lighttpd.conf ~/work/lighttpd/lighttpd-1.4.54/doc/config/modules.conf ./config

        修改lighttpd.conf 如下:(只列出了需要修改的地方)

var.log_root    = "/root/lighttpd/log"
var.server_root = "/root/lighttpd"
var.state_dir   = "/root/lighttpd"
var.home_dir    = "/root/lighttpd"
var.conf_dir    = "/root/lighttpd/config"

var.cache_dir   = server_root + "/cache"

server.use-ipv6 = "disable"

#server.username  = "lighttpd"
#server.groupname = "lighttpd"

server.document-root = server_root + "/webpages"

#server.pid-file = state_dir + "/lighttpd.pid"

#include "conf.d/access_log.conf"

#server.network-backend = "sendfile"

#$HTTP["url"] =~ "\.pdf$" {
#  server.range-requests = "disable"
#}

server.upload-dirs = ( "/root/lighttpd/upload" )

           修改modules.conf  如下:(只列出了需要修改的地方)       

server.modules = (
  "mod_access",
  "mod_alias",
#  "mod_auth",
#  "mod_authn_file",
#  "mod_evasive",
#  "mod_setenv",
#  "mod_usertrack",
#  "mod_redirect",
#  "mod_rewrite",
)

include "conf.d/cgi.conf"

        修改conf.d/cgi.conf    如下:(只列出了需要修改的地方)   

cgi.assign = (".cgi" => "")
#cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
#                               ".cgi" => "/usr/bin/perl",
#                               ".rb"  => "/usr/bin/ruby",
#                               ".erb" => "/usr/bin/eruby",
#                               ".py"  => "/usr/bin/python" )

alias.url += ( "/cgi-bin" => server_root + "/cgi-bin" )

 五:测试网页添加      

        在_install/webpages目录下创建index.html文件,文件中添加如下内容:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>lighttpd Test</title>
</head>
<body>
<p>Hello World!</p>
<hr>
<p>Test Page!</p>
</body>
</html>

六:lighttpd 服务测试

        将~/work/lighttpd/_install 整个文件夹全部拷贝到开发板/root/下 并重命名为lighttpd,此路径为第四步中配置文件设置,可自行修改,检查开发板是否有/var/tmp 目录,没有则新建。

        在开发板中:

             cd /root/lighttpd/sbin

            ./lighttpd -f ../config/lighttpd.conf -m ../lib/

        在pc端浏览器中输入开发板ip即可弹出网页,如下:

        

         

                

                


 

  • 51
    点赞
  • 54
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值