nginx by port
php5 by port
mod_fastcgi by port
rehash
/usr/local/bin/php-cgi -h
-b
應再安裝
spawn-fcgi
此套件包在lighttpd ,不過已經分割出來成為一個獨立的project了,相關的訊息在here
anyway 開始安裝 lightttpd
pkg_add -r -v lighttpd (-r 處理相依性, -v 詳細模式)
裝完了之後, 其實我們僅僅需要 spawn-fcgi 此執行檔
先將spawn-fcgi 搬到家目錄下
rehash
whereis spawn-fcgi
spawn-fcgi: /usr/local/bin/spawn-fcgi
cp /usr/local/bin/spawn-fcgi ~
pkg_delete -v lighttpd-1.4.18_1
vi /usr/local/etc/nginx/nginx.conf
location 修改
index index.php index.html
unmark 以下部分
location ~ \.php$ {
root /usr/local/www/nginx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
紅色是修改的部分
/usr/local/etc/rc.d/nginx restart
啟動
php 的fastcgi
/usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/local/bin/php-cgi參考網站有
轉錄自 FreeBSDCHINAWiki 的 fastcgi script
#!/bin/sh
PROVIDES=php-cgi
LIGHTTPD_FCGI=/usr/local/bin/spawn-fcgi
SERVER_IP=127.0.0.1
SERVER_PORT=9000
SERVER_USER=www
SERVER_GROUP=www
PHP_CGI=/usr/local/bin/php-cgi
PGREP=/bin/pgrep
KILLALL=/usr/bin/killall
### No editing below ####
cmd=$1
pcgi_start(){
echo "Starting $PROVIDES..."
$LIGHTTPD_FCGI -a $SERVER_IP -p $SERVER_PORT -u $SERVER_USER -g $SERVER_GROUP -f $PHP_CGI
}
pcgi_stop(){
echo "Killing $PROVIDES..."
$KILLALL $PROVIDES
}
pcgi_restart(){
pcgi_stop
pcgi_start
}
pcgi_status(){
$PGREP $PROVIDES > /dev/null
[ $? -eq 0 ] && echo "$PROVIDES running" || echo "$PROVIDES NOT running"
}
pcgi_help(){
echo "Usage: $0 {start|stop|restart|status}"
}
case ${cmd} in
[Ss][Tt][Aa][Rr][Tt]) pcgi_start;;
[Ss][Tt][Oo][Pp]) pcgi_stop;;
[Rr][Ee][Ss][Tt][Aa][Rr][Tt]) pcgi_restart;;
[Ss][Tt][Aa][Tt][Uu][Ss]) pcgi_status ;;
*) pcgi_help ;;
esac
shiningray 與 張宴 及 義氣幫的gslin大大
及剛提到的FreeBSDChinaWiki
沒有留言:
張貼留言