這兩天在弄嵌入式web服務器的開發,采用的開源代碼為mini_httpd-1.19。現在總結下mini_httpd-1.19的配置和安裝方法,如下:
1、下載mini_httpd-1.19源代碼:http://www.acme.com/software/mini_httpd/
2、解壓文件:tar zxvf mini_httpd-1.19.tar.gz
3、編譯,安裝(編譯安裝環境為:Fedora)
cd mini_httpd-1.19
make
make install
4、建立存放網頁和cgi的目錄:
mkdir mini
mkdir mini/wwwroot
mkdir mini/wwwroot/cgi-bin
5、創建一個配置文件:vi mini/mini_httpd.conf ,配置文件內容如下:
port=8080
dir=/home/yinfeng/webServer/mini_httpd/mini_httpd-1.20/mini/wwwroot
cgipat=cgi-bin/*
user=nobody
pidfile=/home/yinfeng/webServer/mini_httpd/mini_httpd-1.20/mini_httpd.pid
logfile=/home/yinfeng/webServer/mini_httpd/mini_httpd-1.20/mini_httpd.log
6、把網頁放在wwwroot目錄下;
7、啟動mini_httpd服務器
/usr/local/sbin/mini_httpd -C /home/yinfeng/webServer/mini_httpd/mini_httpd-1.19/mini/mini_httpd.conf
8、在客戶端瀏覽器中訪問mini_httpd服務器,在瀏覽器地址欄中輸入:
localhost:8080
如果能訪問,說明mini_httpd服務器成功啟動並能夠訪問了。