曁 下載並編譯 thttpd source code 成功以後, 下一步就是執行啦 !

1. 把 contrib/redhat-rpm/thttpd.conf 複製到 /etc/

cp contrib/redhat-rpm/thttpd.conf /etc

2. 修改 /etc/thttpd.conf

# This section overrides defaults
#dir=/home/httpd/html
dir=/home/richard/thttpd_root/html
#user=httpd# default = nobody
user=richard
logfile=/var/log/thttpd.log
pidfile=/var/run/thttpd.pid
# This section _documents_ defaults in effect
port=8880 ## uncomment this, change web port to 8880 instead of 80
# nosymlink# default = !chroot
# novhost
# nocgipat
cgipat=/cgi-bin/ ## based on dir
# nothrottles
# host=0.0.0.0
# charset=iso-8859-1

粗體字是我有更動的部份, 共有四行:

2-1. 先把 dir 指向我想放的位置, 方便管理.

2-2. comment 原本的 user = httpd, 改成自己的帳號.

若維持原來的帳號 - httpd, 待會執行時會發生錯誤 : thttpd unknown user - 'httpd'.

2-3. port 改成 8880, 避免衝到其他 service.

2-4. 最後, 參考別人作法, 新增 cgi 路徑, for future work ...

3. 在 /home/richard/thttpd_root/html (也就是  /etc/thttpd.conf 的 dir)下面, 新增一個測試用的 index.html

4. 執行 : thttpd -C /etc/thttpd.conf

順便附上 thttpd --help:

usage:  thttpd [-C configfile] [-p port] [-d dir] [-r|-nor] [-dd data_dir] [-s|-nos] [-v|-nov] [-g|-nog] [-u user] [-c cgipat] [-t throttles] [-h host] [-l logfile] [-i pidfile] [-T charset] [-P P3P] [-M maxage] [-V] [-D]

如果不跑 -C xxx.conf, 可能就要一個一個下指令了.

5. 測試 !

http://127.0.0.1:8880  -> 有看到自己新增的 index.html !! 成功 !!

 

參考: 

http://shyuanliang.blogspot.tw/2013/02/thttpd-web-server

http://personlin118.pixnet.net/blog/post/846126-thttpd%E4%BD%BF%E7%94%A8%E4%BB%8B%E7%B4%B9

 

 

 

 

 

arrow
arrow
    全站熱搜

    kk 發表在 痞客邦 留言(0) 人氣()