博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ubuntu 下安装thttpd Web服务器
阅读量:1984 次
发布时间:2019-04-27

本文共 2301 字,大约阅读时间需要 7 分钟。

不知道大家是不是真的需要用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

# 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

 

转载地址:http://npwvf.baihongyu.com/

你可能感兴趣的文章
在 Vue 中用 Axios 异步请求API
查看>>
Mysql 之主从复制
查看>>
【NLP学习笔记】中文分词(Word Segmentation,WS)
查看>>
对于时间复杂度的通俗理解
查看>>
如何输入多组数据并输出每组数据的和?
查看>>
行阶梯型矩阵
查看>>
JAVA学习笔记6 - 数组
查看>>
【接口自动化】
查看>>
Python解惑之:True与False
查看>>
你要的微信小程序终于来了
查看>>
有了这些 Chrome 插件,效率提升10倍(建议收藏)
查看>>
一名 Google 工程师的大数据处理经验
查看>>
命名难,难于上青天
查看>>
没钱没公司,怎么做一款付费产品
查看>>
终于来了!Python 编辑神器 Jupyter ,推出首款官方可视化 Debug 工具!
查看>>
代码整洁之道-编写 Pythonic 代码
查看>>
树莓派程序开机自启动
查看>>
连锁门店无线通信方案
查看>>
配置Lotus Domino集群视频详解
查看>>
Linux软件万花筒
查看>>