Ubuntu下如何安装thttpd Web服务器

来源:爱站网时间:2021-06-17编辑:网友分享
不清楚大家是否真的是需要用appache这个比较复杂且功能较大的web server,因为还有很多时候用webserver也只是一种远程共享访问方式,所以基于Ubuntu下如何安装thttpd Web服务器呢,爱站技术频道小编现在就来解答。

这里,Ubuntu repository的提供了一个简单的web server,名为thttpd,即 tiny http daemon.

thttpd很小,只有74K,它同样支持很多feature. 比如CGI, 基本的认证. thttpd还支持URL的限流。它被设计在高负载下也有极好的性能。

在ubuntu下安装thttpd,很简单:
sudo apt-get install thttpd thttpd-util

安装好后,thttpd已经启动了,你可以在web 浏览器中输入 http://127.0.0.1来测试一下。
他的默认的根目录在这里: /var/www

thttpd的用法
Usage: sudo /etc/init.d/thttpd {start|stop|restart|force-stop|force-reload}

thttpd的配置文件 /etc/thttpd/thttpd.conf也很简单
=========================================
#------------------------------------------------------------------------------#
# thttpd version 2.23beta1 #
# Main configuration file #
#------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
# Port: portnum
# Sets the port number which will be listened by thttpd.
# Default: 80
#这里设置侦听的端口,不需要改动
port=80

# chroot/nochroot
# Sets whether thttpd will chroot after starting.
# Default: nochroot
# 设置是否chroot,不需要改动
chroot

# user: userid
# Specified which user to switch after intialiazation when started as root.
# Default: www-data
# 设置用户的ID,不需要改动
user=www-data

# host: hostname
# Specifies a hostname to bind to.
# Default: Bind to all supported hostnames on the local machine.
# 设置主机名
#host=grugler

# Logfile: logfile path
# Specifies a file for logging.
# Default: Log via syslog()
# 设置日志文件的位置
logfile=/var/log/thttpd.log

linux

# throttles: file
# Specifies a file of throttle settings.
# Default: /etc/thttpd/throttle.conf
# 设置限流的配置文件名
throttles=/etc/thttpd/throttle.conf

# urlpat: pattern
# Specifies which URL can only be only be accessed from the local server.
# Default: None
# urlpat=*.mpeg|*.mp3|*.wav|*.gz|*.jpg|*.gif

# dir: directory
# Specifies a directory to chdir() to after thttpd starts.
# This directory will most likely be the directory you will be serving your
# clients from.
# Default: `cwd`
# 这里设置web server的根目录
dir=/var/www

# cgipat: pattern
# Specifies which URL may contain executable CGI files.
# Default: None
cgipat=/cgi-bin/*
=================================================

限流配置文件的配置更简单,大家看看注释就明白了,一秒钟的最大流量为3000个字节
=================================================
# Format:
#
#

#* 3000 # Only devote 3000 bytes per second to our dialup

 以上就是爱站技术频道小编带来的关于Ubuntu下如何安装thttpd Web服务器的文章内容,如果感兴趣还想了解更多服务器教程相关资讯及教程,请关注爱站技术频道小编。

上一篇:Linux中安装Dedecms文章系统的注意事项

下一篇:Linux系统服务器下文件被误删该怎么办

您可能感兴趣的文章

相关阅读

热门软件源码

最新软件源码下载