zoukankan      html  css  js  c++  java
  • 嵌入式web服务器-thttpd

    交叉编译thttpd 

    http://lakie.blog.163.com/blog/static/45185220201162910432330/

    thttpd安装与调试

    http://blog.csdn.net/21aspnet/article/details/7045845

    启动thttpd

    # /usr/local/thttpd/sbin/thttpd -C /usr/local/thttpd/conf/thttpd.conf

    7. 在开发板上为thttpd创建一个独立的用户:httpd,并用此用户创建httpd服务的根目录html

    最简单的测试方法不用配置文件,直接输入命令:
    thttpd -p 80 -d /home/httpd/html -u root 启动

     http://www.docin.com/p-457056503.html

    thttpd配置

    Thttpd manual

    http://www.cnblogs.com/elect-fans/archive/2011/12/06/2408712.html(含有详细的thttpd的命令说明)

    用thttpd做Web Server

    http://www.oschina.net/question/234345_42631

    嵌入式设备web服务器比较

    http://blog.csdn.net/newnewman80/article/details/8809560

    linux下,主要有三个web服务器:httpd,thttpd和boa。httpd是最简单的一个web服务器,功能也最弱,不支持认证、CGI。 thttpdWeb服务器和boaWeb服务器都支持认证、CGI等,功能都比较全。如果Web服务器仅需提供一些静态页面,例如系统介绍、简单的在线帮 助等,完全可以用静态服务器httpd来实现。但若需要与用户进行交互,例如数据查询、实时状态查询等,则必须使用动态Web技术,可以选用httpd或 是boa来实现。但是thttpd在运行过程中所需要的资源远远大于boa。为了实现动态Web技术,这里本文选择实现一个支持CGI的、非常适合于嵌入 式系统的web服务器boa。

    httpd是busybox中自带的web server,功能弱,不支持认证和CGI。thttpd和boa都支持认证CGI,功能比较全,Boa是一个单任务的小型http服务器,设计的小型系统不要数据库操作,所以可以使用thttpd作为server.

    1. 编译thttpd

    yingc@yingc:~/gcyin/test/flickr/thttpd-2.25b$ CC=csky-linux-gcc LDFLAGS=-static ./configure --host=csky --prefix=/home/yingc/gcyin/test/flickr/gclib/thttpd
    loading cache ./config.cache
    checking host system type... csky-unknown-none
    checking target system type... csky-unknown-none
    checking build system type... csky-unknown-none
    checking for gcc... (cached) csky-linux-gcc
    checking whether the C compiler (csky-linux-gcc  ) works... yes
    checking whether the C compiler (csky-linux-gcc  ) is a cross-compiler... yes
    checking whether we are using GNU C... (cached) yes
    checking whether csky-linux-gcc accepts -g... (cached) yes

    yingc@yingc:~/gcyin/test/flickr/thttpd-2.25b$ sudo make install
    mkdir -p /home/yingc/gcyin/test/flickr/gclib/thttpd/sbin
    /usr/bin/install -c -m 555 -o bin -g bin thttpd /home/yingc/gcyin/test/flickr/gclib/thttpd/sbin
    mkdir -p /home/yingc/gcyin/test/flickr/gclib/thttpd/man/man8
    /usr/bin/install -c -m 444 -o bin -g bin thttpd.8 /home/yingc/gcyin/test/flickr/gclib/thttpd/man/man8
    for i in cgi-src extras ; do (
            cd $i ;
            pwd ;
            make 
            WEBDIR=/home/yingc/gcyin/test/flickr/gclib/thttpd/www
            CGIBINDIR=/home/yingc/gcyin/test/flickr/gclib/thttpd/www/cgi-bin
            MANDIR=/home/yingc/gcyin/test/flickr/gclib/thttpd/man
            WEBGROUP=www
            install
        ) ; done
    /home/yingc/gcyin/test/flickr/thttpd-2.25b/cgi-src
    make[1]: Entering directory `/home/yingc/gcyin/test/flickr/thttpd-2.25b/cgi-src'
    mkdir -p /home/yingc/gcyin/test/flickr/gclib/thttpd/www/cgi-bin
    rm -f /home/yingc/gcyin/test/flickr/gclib/thttpd/www/cgi-bin/redirect
    cp redirect /home/yingc/gcyin/test/flickr/gclib/thttpd/www/cgi-bin/redirect
    rm -f /home/yingc/gcyin/test/flickr/gclib/thttpd/man/man8/redirect.8
    cp redirect.8 /home/yingc/gcyin/test/flickr/gclib/thttpd/man/man8/redirect.8
    rm -f /home/yingc/gcyin/test/flickr/gclib/thttpd/www/cgi-bin/ssi
    cp ssi /home/yingc/gcyin/test/flickr/gclib/thttpd/www/cgi-bin/ssi
    rm -f /home/yingc/gcyin/test/flickr/gclib/thttpd/man/man8/ssi.8
    cp ssi.8 /home/yingc/gcyin/test/flickr/gclib/thttpd/man/man8/ssi.8
    rm -f /home/yingc/gcyin/test/flickr/gclib/thttpd/www/cgi-bin/phf
    cp phf /home/yingc/gcyin/test/flickr/gclib/thttpd/www/cgi-bin/phf
    make[1]: Leaving directory `/home/yingc/gcyin/test/flickr/thttpd-2.25b/cgi-src'
    /home/yingc/gcyin/test/flickr/thttpd-2.25b/extras
    make[1]: Entering directory `/home/yingc/gcyin/test/flickr/thttpd-2.25b/extras'
    rm -f /home/yingc/gcyin/test/flickr/gclib/thttpd/sbin/makeweb /home/yingc/gcyin/test/flickr/gclib/thttpd/sbin/htpasswd /home/yingc/gcyin/test/flickr/gclib/thttpd/sbin/syslogtocern
    cp makeweb /home/yingc/gcyin/test/flickr/gclib/thttpd/sbin/makeweb
    chgrp www /home/yingc/gcyin/test/flickr/gclib/thttpd/sbin/makeweb
    chmod 2755 /home/yingc/gcyin/test/flickr/gclib/thttpd/sbin/makeweb
    cp htpasswd /home/yingc/gcyin/test/flickr/gclib/thttpd/sbin/htpasswd
    cp syslogtocern /home/yingc/gcyin/test/flickr/gclib/thttpd/sbin/syslogtocern
    rm -f /home/yingc/gcyin/test/flickr/gclib/thttpd/man/man1/makeweb.1
    cp makeweb.1 /home/yingc/gcyin/test/flickr/gclib/thttpd/man/man1/makeweb.1
    cp: cannot create regular file `/home/yingc/gcyin/test/flickr/gclib/thttpd/man/man1/makeweb.1': No such file or directory
    make[1]: *** [install] Error 1
    make[1]: Leaving directory `/home/yingc/gcyin/test/flickr/thttpd-2.25b/extras'
    make: *** [installsubdirs] Error 2

    注:make install时会出现一些权限类的错误。可以修改几个地方:

    1:修改./Makefile.in

    111 installthis:
    112     -mkdir -p $(DESTDIR)$(BINDIR)
    113     $(INSTALL)  thttpd $(DESTDIR)$(BINDIR)
    114     #$(INSTALL) -m 555 -o bin -g bin thttpd $(DESTDIR)$(BINDIR)
    115
    116 install-man:
    117     -mkdir -p $(DESTDIR)$(MANDIR)/man8
    118     $(INSTALL) thttpd.8 $(DESTDIR)$(MANDIR)/man8
    119     #$(INSTALL) -m 444 -o bin -g bin thttpd.8 $(DESTDIR)$(MANDIR)/man8

    2:修改./extras/Makefile.in

     68 install:    all
     69     rm -f $(BINDIR)/makeweb $(BINDIR)/htpasswd $(BINDIR)/syslogtocern
     70     cp makeweb $(BINDIR)/makeweb
     71     #chgrp $(WEBGROUP) $(BINDIR)/makeweb
     72     #chmod 2755 $(BINDIR)/makeweb
     73     cp htpasswd $(BINDIR)/htpasswd
     74     cp syslogtocern $(BINDIR)/syslogtocern
     75     rm -f $(MANDIR)/man1/makeweb.1
     76     mkdir -p $(MANDIR)/man1
     77     cp  makeweb.1 $(MANDIR)/man1/makeweb.1
     78     rm -f $(MANDIR)/man1/htpasswd.1
     79     cp htpasswd.1 $(MANDIR)/man1/htpasswd.1
     80     rm -f $(MANDIR)/man8/syslogtocern.8
     81     mkdir -p $(MANDIR)/man8
     82     cp syslogtocern.8 $(MANDIR)/man8/syslogtocern.8

  • 相关阅读:
    if __name__ == '__main__' 用法理解
    VSCode 使用
    sys.argv用法简介
    [Python3] RSA的加解密和签名/验签实现 -- 使用pycrytodome
    python requests 超时与重试
    collections模块之defaultdict()与namedtuple()方法简单介绍
    setdefault函数的用法及理解
    python并发编程之IO模型 同步 异步 阻塞 非阻塞
    django+uWSGI+nginx的工作原理流程与部署过程
    Nginx静态服务配置---详解root和alias指令
  • 原文地址:https://www.cnblogs.com/jingzhishen/p/3555905.html
Copyright © 2011-2022 走看看