ubuntu上如何移植thttpd

thttpd的特点

thttpd 是一个简单、小巧、便携、快速且安全的 HTTP 服务器。

简单:
它只处理实现 HTTP/1.1 所需的最低限度。好吧,也许比最低限度多一点。
小:
请参阅比较图表。它还具有非常小的运行时大小,因为它不会分叉并且非常小心内存分配。
便携式:
它可以在大多数类Unix操作系统上干净地编译,特别是包括FreeBSD,SunOS 4,Solaris 2,BSD / OS,Linux,OSF。
快:
在典型使用中,它与最好的全功能服务器(Apache、NCSA、Netscape)一样快。在极端负载下,它的速度要快得多。
安全:
它竭尽全力保护 Web 服务器计算机免受来自其他站点的攻击和破坏。
它还具有一个非常有用的功能(基于 URL 流量的限制),这是其他服务器目前没有的。此外,它还支持开箱即用的 IPv6,无需打补丁。

下载thttpd源码

thttpd (acme.com)icon-default.png?t=N7T8https://www.acme.com/software/thttpd/#releasenotes

编译安装

root@ubuntu:/home/app/thttpd# make
root@ubuntu:/home/app/thttpd# make install
mkdir -p /usr/local/sbin
/usr/bin/install -c -m 555 -o bin -g bin thttpd /usr/local/sbin
mkdir -p /usr/local/man/man8
/usr/bin/install -c -m 444 -o bin -g bin thttpd.8 /usr/local/man/man8
for i in cgi-src extras ; do ( \
        cd $i ; \
        pwd ; \
        make  \
        WEBDIR=/usr/local/www \
        CGIBINDIR=/usr/local/www/cgi-bin \
        MANDIR=/usr/local/man \
        WEBGROUP=www \
        install \
    ) ; done
/home/app/thttpd/cgi-src
make[1]: Entering directory `/home/app/thttpd/cgi-src'
mkdir -p /usr/local/www/cgi-bin
rm -f /usr/local/www/cgi-bin/redirect
cp redirect /usr/local/www/cgi-bin/redirect
rm -f /usr/local/man/man8/redirect.8
cp redirect.8 /usr/local/man/man8/redirect.8
rm -f /usr/local/www/cgi-bin/ssi
cp ssi /usr/local/www/cgi-bin/ssi
rm -f /usr/local/man/man8/ssi.8
cp ssi.8 /usr/local/man/man8/ssi.8
rm -f /usr/local/www/cgi-bin/phf
cp phf /usr/local/www/cgi-bin/phf
make[1]: Leaving directory `/home/app/thttpd/cgi-src'
/home/ /app/thttpd/extras
make[1]: Entering directory `/home/app/thttpd/extras'
rm -f /usr/local/sbin/makeweb /usr/local/sbin/htpasswd /usr/local/sbin/syslogtocern
cp makeweb /usr/local/sbin/makeweb
chgrp www /usr/local/sbin/makeweb
chgrp: invalid group: ‘www’
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/ /app/thttpd/extras'
make: *** [installsubdirs] Error 2

遇到报错,别着急

解决方法:
root@ubuntu:/home/app/thttpd# cat /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:syslog,tina
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:tina
floppy:x:25:
tape:x:26:
sudo:x:27:tina
audio:x:29:pulse
dip:x:30:tina
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:tina
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
libuuid:x:101:
netdev:x:102:
crontab:x:103:
syslog:x:104:
fuse:x:105:
messagebus:x:106:
ssl-cert:x:107:
lpadmin:x:108:tina
scanner:x:109:saned
mlocate:x:110:
ssh:x:111:
utempter:x:112:
avahi-autoipd:x:113:
rtkit:x:114:
saned:x:115:
whoopsie:x:116:
avahi:x:117:
lightdm:x:118:
nopasswdlogin:x:119:
bluetooth:x:120:
colord:x:121:
pulse:x:122:
pulse-access:x:123:
tina:x:1000:
sambashare:x:124:tina
ftp:x:125:
_cvsadmin:x:126:
tftp:x:127:
root@ubuntu:/home/app/thttpd# addgroup www
Adding group `www' (GID 1001) ...
Done.

root@ubuntu:/home/app/thttpd# cat /etc/group
www:x:1001:
----------------------------------------------------------------
root@ubuntu:/home/app/thttpd# make install
mkdir -p /usr/local/sbin
/usr/bin/install -c -m 555 -o bin -g bin thttpd /usr/local/sbin
mkdir -p /usr/local/man/man8
/usr/bin/install -c -m 444 -o bin -g bin thttpd.8 /usr/local/man/man8
for i in cgi-src extras ; do ( \
        cd $i ; \
        pwd ; \
        make  \
        WEBDIR=/usr/local/www \
        CGIBINDIR=/usr/local/www/cgi-bin \
        MANDIR=/usr/local/man \
        WEBGROUP=www \
        install \
    ) ; done
/home/app/thttpd/cgi-src
make[1]: Entering directory `/home/app/thttpd/cgi-src'
mkdir -p /usr/local/www/cgi-bin
rm -f /usr/local/www/cgi-bin/redirect
cp redirect /usr/local/www/cgi-bin/redirect
rm -f /usr/local/man/man8/redirect.8
cp redirect.8 /usr/local/man/man8/redirect.8
rm -f /usr/local/www/cgi-bin/ssi
cp ssi /usr/local/www/cgi-bin/ssi
rm -f /usr/local/man/man8/ssi.8
cp ssi.8 /usr/local/man/man8/ssi.8
rm -f /usr/local/www/cgi-bin/phf
cp phf /usr/local/www/cgi-bin/phf
make[1]: Leaving directory `/home/app/thttpd/cgi-src'
/home/ /app/thttpd/extras
make[1]: Entering directory `/home/app/thttpd/extras'
rm -f /usr/local/sbin/makeweb /usr/local/sbin/htpasswd /usr/local/sbin/syslogtocern
cp makeweb /usr/local/sbin/makeweb
chgrp www /usr/local/sbin/makeweb
chmod 2755 /usr/local/sbin/makeweb
cp htpasswd /usr/local/sbin/htpasswd
cp syslogtocern /usr/local/sbin/syslogtocern
rm -f /usr/local/man/man1/makeweb.1
cp makeweb.1 /usr/local/man/man1/makeweb.1
cp: cannot create regular file ‘/usr/local/man/man1/makeweb.1’: No such file or directory
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/app/thttpd/extras'
make: *** [installsubdirs] Error 2
root@ubuntu:/home/app/thttpd# cd /usr/local/thttpd/man/
bash: cd: /usr/local/thttpd/man/: No such file or directory

又有报错了,别着急。
解决方法:
root@ubuntu:/usr/local/man# mkdir -p man1

root@ubuntu:/home/app/thttpd# make install
mkdir -p /usr/local/sbin
/usr/bin/install -c -m 555 -o bin -g bin thttpd /usr/local/sbin
mkdir -p /usr/local/man/man8
/usr/bin/install -c -m 444 -o bin -g bin thttpd.8 /usr/local/man/man8
for i in cgi-src extras ; do ( \
        cd $i ; \
        pwd ; \
        make  \
        WEBDIR=/usr/local/www \
        CGIBINDIR=/usr/local/www/cgi-bin \
        MANDIR=/usr/local/man \
        WEBGROUP=www \
        install \
    ) ; done
/home/app/thttpd/cgi-src
make[1]: Entering directory `/home/app/thttpd/cgi-src'
mkdir -p /usr/local/www/cgi-bin
rm -f /usr/local/www/cgi-bin/redirect
cp redirect /usr/local/www/cgi-bin/redirect
rm -f /usr/local/man/man8/redirect.8
cp redirect.8 /usr/local/man/man8/redirect.8
rm -f /usr/local/www/cgi-bin/ssi
cp ssi /usr/local/www/cgi-bin/ssi
rm -f /usr/local/man/man8/ssi.8
cp ssi.8 /usr/local/man/man8/ssi.8
rm -f /usr/local/www/cgi-bin/phf
cp phf /usr/local/www/cgi-bin/phf
make[1]: Leaving directory `/home/app/thttpd/cgi-src'
/home/app/thttpd/extras
make[1]: Entering directory `/home/app/thttpd/extras'
rm -f /usr/local/sbin/makeweb /usr/local/sbin/htpasswd /usr/local/sbin/syslogtocern
cp makeweb /usr/local/sbin/makeweb
chgrp www /usr/local/sbin/makeweb
chmod 2755 /usr/local/sbin/makeweb
cp htpasswd /usr/local/sbin/htpasswd
cp syslogtocern /usr/local/sbin/syslogtocern
rm -f /usr/local/man/man1/makeweb.1
cp makeweb.1 /usr/local/man/man1/makeweb.1
rm -f /usr/local/man/man1/htpasswd.1
cp htpasswd.1 /usr/local/man/man1/htpasswd.1
rm -f /usr/local/man/man8/syslogtocern.8
cp syslogtocern.8 /usr/local/man/man8/syslogtocern.8
make[1]: Leaving directory `/home/app/thttpd/extras'

配置


root@ubuntu:/home/app/thttpd# cat thttpd.conf 
# This section overrides defaults
#chroot
# This section _documents_ defaults in effect
# port=80
port=888
# nosymlink# default = !chroot
# novhost
# nocgipat
# nothrottles
# host=0.0.0.0
# charset=iso-8859-1
#dir=.
dir=/home/app/www
#cgipat=/*.cgi
cgipat=/cgi/*.cgi
logfile=/tmp/thttpd.log
pidfile=/var/run/thttpd.pid
#user=root

启动服务


thttpd -C thttpd.conf -d /home/app/www/ -u root -l /var/log/test_httpd.log

或者
thttpd -C thttpd.conf -l /var/log/test_httpd.log
 

你可能感兴趣的:(WEB,ubuntu,web)