좀 더 빠른 이미지 서버와 단순한 웹서버에 사용하기 위한 thttpd 설치 및 사용방법 매뉴얼이다.
1. 설치
2. 설정파일 생성
3. 데몬 구동
- 테스트
- 설정파일 없이 옵션으로만 구동시
- 시작 스크립트에 등록
출처 : http://blog.easysw.net
1. 설치
wget http://www.acme.com/software/thttpd/thttpd-2.25b.tar.gz
tar xfzp thttpd-2.25b.tar.gz
cd thttpd-2.25b
./configure --help
vi config.h
./configure --prefix=/usr/local/thttpd
make
make install
strip -s /usr/local/thttpd/sbin/*
tar xfzp thttpd-2.25b.tar.gz
cd thttpd-2.25b
./configure --help
vi config.h
./configure --prefix=/usr/local/thttpd
make
make install
strip -s /usr/local/thttpd/sbin/*
2. 설정파일 생성
cd /usr/local/thttpd/conf
vi thttpd.conf
vi thttpd.conf
# This section overrides defaults
dir=/usr/local/thttpd/www
# chroot : 파이너리 cgi 파일 접근이 불가능 하게 됨
nochroot
user=nobody # default = nobody
logfile=/var/log/thttpd.log
pidfile=/var/run/thttpd.pid
cgipat=/cgi-bin/*
# This section _documents_ defaults in effect
port=80
nosymlink # default = !chroot
novhost
# nocgipat
# nothrottles
# host=0.0.0.0
# charset=iso-8859-1
dir=/usr/local/thttpd/www
# chroot : 파이너리 cgi 파일 접근이 불가능 하게 됨
nochroot
user=nobody # default = nobody
logfile=/var/log/thttpd.log
pidfile=/var/run/thttpd.pid
cgipat=/cgi-bin/*
# This section _documents_ defaults in effect
port=80
nosymlink # default = !chroot
novhost
# nocgipat
# nothrottles
# host=0.0.0.0
# charset=iso-8859-1
vi cgi-bin/test.cgi
use CGI;
my $cgi = CGI->new();
my $mode = $cgi->param('mode');
print $cgi->header();
print "<h1>mode is $mode </h1>";
my $cgi = CGI->new();
my $mode = $cgi->param('mode');
print $cgi->header();
print "<h1>mode is $mode </h1>";
chmod 755 cgi-bin/test.cgi
3. 데몬 구동
- 테스트
/usr/local/thttpd/sbin/thttpd -C /usr/local/thttpd/conf/thttpd.conf
- 설정파일 없이 옵션으로만 구동시
/usr/local/thttpd/sbin/thttpd -u root -d /usr/local/thttpd/www -nor -h 211.11.22.33 -p 80 -c "/cgi-bin/*"
- 시작 스크립트에 등록
]# cp /usr/local/src/thttpd-2.25b/contrib/redhat-rpm/thttpd.init .
]# perl -pi -e 's/daemon \/usr\/sbin\/thttpd -C \/etc\/thttpd.conf/daemon \/usr\/local\/thttpd\/sbin\/thttpd -C \/usr\/local\/thttpd\/conf\/thttpd.conf/' thttpd.init
]# grep thttpd.conf thttpd.init
daemon /usr/local/thttpd/sbin/thttpd -C /usr/local/thttpd/conf/thttpd.conf
]# mv thttpd.init /etc/init.d/thttpd
]# chkconfig thttpd on
]# service thttpd start
]# lynx --dump http://localhost/
]# perl -pi -e 's/daemon \/usr\/sbin\/thttpd -C \/etc\/thttpd.conf/daemon \/usr\/local\/thttpd\/sbin\/thttpd -C \/usr\/local\/thttpd\/conf\/thttpd.conf/' thttpd.init
]# grep thttpd.conf thttpd.init
daemon /usr/local/thttpd/sbin/thttpd -C /usr/local/thttpd/conf/thttpd.conf
]# mv thttpd.init /etc/init.d/thttpd
]# chkconfig thttpd on
]# service thttpd start
]# lynx --dump http://localhost/
출처 : http://blog.easysw.net
728x90
댓글