Total Pageviews

Sunday 31 March 2013

在路由器上,配置nginx+php环境

1、安装相关依赖环境
ipkg install nginx php spawn-fcgi php-fcgi

2、修改nginx配置文件
vi /opt/etc/nginx/nginx.conf

    需要修改的内容:   
user root; 
location ~ \.php$ {        
    fastcgi_pass   127.0.0.1:9000;        
    fastcgi_index  index.php;        
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;        
    include        fastcgi_params;        
}

3、最终在shell里执行下面的命令
   
spawn-fcgi -a 127.0.0.1 -p 9000 -C 1 -f /opt/bin/php-fcgi
/etc/init.d/nginx start