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 瀏覽器中輸入 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
# 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:
# <pattern> <number>
#
#* 3000 # Only devote 3000 bytes per second to our dialup
?
總結
以上是生活随笔為你收集整理的Ubuntu 下安装thttpd Web服务器的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 家用电视机机想买个60寸或65寸的,有哪
- 下一篇: “利是身灾合少求”上一句是什么