最近在玩web server效能,所以就拿Lighttpd + Fastcgi 來當測試對象
實作環境:
- Ubuntu 10.04
- Lighttpd 1.4.26
- FastCGI 2.4.0
下載位置:
- Lighttpd 官網 →http://www.lighttpd.net/download
- FastCGI官網→http://www.fastcgi.com/drupal/node/5
安裝及設定
- 安裝Lighttpd
1. 透過synaptic安裝Lighttpd
or
1. download lighttpd-1.4.26.tar.gz
2. #tar -zxvf lighttpd-1.4.26.tar.gz
3. #cd lighttpd-1.4.26
4. #./configure --prefix=/etc/lighttpd( 這邊可以依照你要的安裝路徑去放置)
這邊如果出現錯誤訊息如下
5. 這時候會出現說pcre沒有找到
#tar -zxvf pcre-7.7.tar.gz
#cd pcre 7.7
#./configure
#make;make install
6. 再重新 # ./configure --prefix=/你要安裝的路徑
7. #make;make install
- 安裝FastCGI
1. download fcgi-2.4.0.tar.gz
2. #tar -zxvf fcgi-2.4.0.tar.gz
3. #cd fcgi-2.4.0
4. #./configure --preifx=/你要安裝的路徑
5. #make
這邊會出現錯誤訊息如下
6. Google搜尋了一下,也有人碰到相同問題
解決方式
#vim include/fcgio.h,在前面加入這段 #include <cstdio>
7. 再重新# make;make install
- Run CGI
1. check /usr/local/bin裡面有沒有cgi-fcgi
2. #cd /fcgi-2.4.0/examples
3. #cp -rf .libs /etc/lighttpd/htdocs/
4. #cp echo /etc/lighttpd/htdocs/echo.fcgi (將範例的fcgi丟到lighttpd server)
5. #vim /etc/lighttpd/lighttpd.conf
6. 將mod_auth&mod_fastcgi 前面的註解拿掉
fastcgi.server = ( ".fcgi" =>
( "127.0.0.1" =>
(
"host" => "192.168.81.169",#填上你Server IP
"port" => 1026,
"check-local" => "disable"
# "bin-path" => "/usr/bin/php-cgi"
# "bin-path" => "/usr/local/bin/cgi-fcgi -bind -connect 127.0.0.1:1026"
# "bin-path" => "./htdocs/echo.fcgi"
)
)
)
$HTTP["host"] == ".fcgi" {
alias.url = ( "/fcgi-bin" => "/etc/lighttpd/htdocs/" )
}
7. #cgi-fcgi -start -connect 192.168.81.169:1026 /etc/lighttpd/htdocs/echo.fcgi
8. 然後在網址列上輸入 http://192.168.81.169/echo.fcgi
如果有顯示出來就代表成功了,如果沒有的話重起lighttpd
成功畫面
參考文章
http://calories.pixnet.net/blog/post/25207773-set-up-a-web-server-on-fedora11%3A-lighttpd%2B-fastcgi
請先 登入 以發表留言。