Cross compilation thttpd


thttpd Installation and commissioning

start-up thttpd

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


7. On the development board thttpd Create a separate user :httpd, And use this user to create httpd Root directory of the service html

The simplest way to test is without a configuration file , Enter the command directly :
thttpd -p 80 -d /home/httpd/html -u root start-up

thttpd To configure

Thttpd manual Contains detailed thttpd The command description of )

use thttpd do Web Server

Embedded device web Server comparison

linux Next , There are three main ones web The server :httpd,thttpd and boa.httpd It's the simplest one web The server , It's also the weakest , Authentication is not supported 、CGI. thttpdWeb The server and boaWeb All servers support authentication 、CGI etc. , The functions are quite complete . If Web The server just needs to provide some static pages , For example, system introduction 、 Simple online help Help, etc , You can use a static server httpd To achieve . But if you need to interact with users , For example, data query 、 Real time status query, etc , You have to use dynamic Web technology , May choose httpd or yes boa To achieve . however thttpd The resources needed in the process of operation are far greater than boa. In order to achieve dynamic Web technology , Here we choose to implement a support CGI Of 、 Perfect for embedding In a systematic way web The server boa.

httpd yes busybox The built-in web server, Weak function , Authentication and CGI.thttpd and boa All support certification CGI, The functions are quite complete ,Boa It's a small single task http The server , The design of a small system does not need database operation , So you can use thttpd As server.

1. compile thttpd

[email protected]:~/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



[email protected]:~/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
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'
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

notes :make install There will be some permission class errors when using . There are several areas that can be modified :

1: modify ./

111 installthis:
112     -mkdir -p $(DESTDIR)$(BINDIR)
113     $(INSTALL)  thttpd $(DESTDIR)$(BINDIR)
114     #$(INSTALL) -m 555 -o bin -g bin thttpd $(DESTDIR)$(BINDIR)
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: modify ./extras/

 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