Ubuntu 下安装thttpd Web服务器

不知道大家是不是真的需要用appache这么复杂的功能这么强大的web server,其实有很多时候使用webserver也只是一种远程共享访问的方式。这里,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 浏览器中输入 来测试一下。
他的默认的根目录在这里: /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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wypsds.html