顯示具有 web server 標籤的文章。 顯示所有文章
顯示具有 web server 標籤的文章。 顯示所有文章

2015年5月11日 星期一

ubuntu 使用 mini-httpd 當 web server

這個是不小心找到的, 原作者就是開發 thttpd , 當初的目的, 只是想知道用古老的 fork 有多慢, 作者實測認為有 apache 90% 的效能, 而 mini-httpd 有 GET, POST, HEAD method, 有密碼保護, 有CGI, 當作一個 embedded web server 跑一些簡易網頁應該是夠用了.

可到此一看究竟 http://acme.com/software/mini_httpd/

更奇怪的是 ubuntu 已經拋棄 thttpd, 但是 mini-httpd 還在它的套件庫裏面.


1. 下載 mini-httpd
sudo apt-get install mini-httpd
mini-httpd 被安裝到 /usr/sbin

同時會下載 apache2-utils, 會用到的應該就是 htpasswd, 其實在 mini-httpd source code 也有 htpasswd.c  若是由 source code rebuild, 應該不用下載 apache2-utils

2. 修改設定
sudo nano /etc/default/mini-httpd
找到 START=0, 改成 START=1

sudo nano /etc/mini-httpd.conf
找到 user, 將其改為 user=www-data
找到 data_dir, 將其改為 data_dir=/var/www

3. 啟動/暫停 mini-httpd
sudo /etc/init.d/mini-httpd start
sudo /etc/init.d/mini-httpd stop

4. log file 在 /var/log/mini-httpd.log

2015年5月10日 星期日

build CIVETWEB under Linux


mongoose 以前是 MIT 授權 (2013), 後來改成 GPL or 商業授權.
它標榜的是單一 source code, less memory footprint , 適合 embedded 使用.

現在有人拿 MIT 授權時代的 mongoose 來發展, 依然維持 MIT 授權
可在此找到 source code
https://github.com/bel2125/civetweb

因為需要 libssl.so & libcrypto.so
sudo apt-get install libssl-dev

http://sourceforge.net/projects/civetweb/files/1.6/
取得 civetweb.tar.gz 

make help
make build
make install
執行檔在 /usr/local/bin/civetweb
設定檔在  /usr/local/etc/civetweb.conf








ubuntu 14.04.2 安裝 thttpd

1. 安裝
用 sudo apt-get install thttpd  已經找不到 package

user@user-ubuntu140402:~$ sudo apt-get install thttpd
[sudo] password for user:
Reading package lists... Done
Building dependency tree    
Reading state information... Done
Package thttpd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'thttpd' has no installation candidate

還好本家 debian 還是有這個 package

https://packages.debian.org/squeeze/thttpd
http://ftp.tw.debian.org/debian/pool/main/t/thttpd/

下載 deb, 用 software center 自動安裝

2. 修改設定
sudo cp /etc/defualt/thttpd /etc/defualt/thttpd.backup
sudo nano /etc/defualt/thttpd
find and change ENABLED=no to ENABLED=yes

3. 啟動/停止 thttpd
sudo /etc/init.d/thttpd start
sudo /etc/init.d/thttpd stop

4. 使用事項
a. 預設使用 /var/www 當網頁根目錄, 相關 html, 圖檔等資料存放位置
b. 設定檔 /etc/thttpd/thttpd.conf 可開啟或關掉 thttpd 某項功能






追蹤者