pantz.org banner
Thttpd install and configuration
Posted on 07-25-2006 00:13:00 UTC | Updated on 07-25-2006 00:13:00 UTC
Section: /software/thttpd/ | Permanent Link

thttpd is a simple, small, portable, fast, and secure HTTP server. It handles only the minimum necessary to implement HTTP/1.1. It also has a very small run-time size, since it does not fork and is very careful about memory allocation. It compiles cleanly on most any Unix-like OS.In typical use it's about as fast as the best full-featured servers sometimes faster.It goes to great lengths to protect the web server machine against attacks and breakins from other sites.

1. Install thttpd from packages.

pkg_add -v http://openbsd.secsup.org/3.8/packages/i386/thttpd-2.25b.tgz

2. You can start the server by using the line below. You will need to change the different parts of the line to your own config. -u is the user the server will run as. In OpenBSD this is _thttpd. -l is where to keep the server logs. The one below is set for no logging. -d is the directory where your document root is to go. The website your hosting. -h is the host ip you want to bind to. If you leave -h out then it will listen on all interfaces.

/usr/local/sbin/thttpd -r -u _thttpd -l /dev/null -d /var/www/htdocs/ -h 192.168.0.1

3. Put the line below in /etc/rc.local to start thttpd on reboot.

# Start thtppd
if [ -x /usr/local/sbin/thttpd ]; then
echo -n ' thttpd'
/usr/local/sbin/thttpd -r -u _thttpd  -l /dev/null -d /var/www/htdocs/ -h 192.168.0.1
fi

If you need to compile thttpd yourself then there are a few settings (below) I like to set but to each his own. All files are in the root dir after untaring the thttpd source. What I like to set on OpenBSD are:

In config.h I change:

#define IDLE_SEND_TIMELIMIT 120

#define DEFAULT_USER "_thttpd"

#ifdef notdef
#define ERR_APPEND_SERVER_INFO
#endif

#define INDEX_NAMES "index.shtml"

In version.h file remove version and software info.

In mime_types.txt file put in "shtml text/html; charset=%s"

Note: Make the dir "errors" in the root of the website and the errorcode as as the name of the file with the letters "err" in front for personalized errors. Ex. err404.html

Reddit!

Related stories


RSS Feed RSS feed logo

About


3com

3ware

alsa

alsactl

alsamixer

amd

android

apache

areca

arm

ati

auditd

awk

badblocks

bash

bind

bios

bonnie

cable

carp

cat5

cdrom

cellphone

centos

chart

chrome

chromebook

cifs

cisco

cloudera

comcast

commands

comodo

compiz-fusion

corsair

cpufreq

cpufrequtils

cpuspeed

cron

crontab

crossover

cu

cups

cvs

database

dbus

dd

dd_rescue

ddclient

debian

decimal

dhclient

dhcp

diagnostic

diskexplorer

disks

dkim

dns

dos

dovecot

drac

dsniff

dvdauthor

e-mail

echo

editor

emerald

encryption

ethernet

expect

ext3

ext4

fat32

fedora

fetchmail

fiber

filesystems

firefox

firewall

flac

flexlm

floppy

flowtools

fonts

format

freebsd

ftp

gdm

gmail

gnome

google

gpg

greasemonkey

greylisting

growisofs

grub

hacking

hadoop

harddrive

hba

hex

hfsc

html

html5

http

https

hulu

idl

ie

ilo

intel

ios

iperf

ipmi

iptables

ipv6

irix

javascript

kde

kernel

kickstart

kmail

kprinter

krecord

kubuntu

kvm

lame

ldap

linux

logfile

lp

lpq

lpr

maradns

matlab

memory

mencoder

mhdd

mkinitrd

mkisofs

moinmoin

motherboard

mouse

movemail

mplayer

multitail

mutt

myodbc

mysql

mythtv

nagios

nameserver

netflix

netflow

nginx

nic

ntfs

ntp

nvidia

odbc

openbsd

openntpd

openoffice

openssh

openssl

openvpn

opteron

parted

partimage

patch

perl

pf

pfflowd

pfsync

photorec

php

pop3

pop3s

ports

postfix

power

procmail

proftpd

proxy

pulseaudio

putty

pxe

python

qemu

r-studio

raid

recovery

redhat

router

rpc

rsync

ruby

saltstack

samba

schedule

screen

scsi

seagate

seatools

sed

sendmail

sgi

shell

siw

smtp

snort

solaris

soundcard

sox

spam

spamd

spf

spotify

sql

sqlite

squid

srs

ssh

ssh.com

ssl

su

subnet

subversion

sudo

sun

supermicro

switches

symbols

syslinux

syslog

systemd

systemrescuecd

t1

tcpip

tcpwrappers

telnet

terminal

testdisk

tftp

thttpd

thunderbird

timezone

ting

tls

tools

tr

trac

tuning

tunnel

ubuntu

unbound

vi

vpn

wget

wiki

windows

windowsxp

wireless

wpa_supplicant

x

xauth

xfree86

xfs

xinearama

xmms

youtube

zdump

zeromq

zic

zlib