/*************************************************************************** * nginx php-cgi php * 说明: * 由于有需要多个web访问的需求,于是选择使用nginx来做端口映射,刚开始配置 * 的时候没法先php还有fpm模式,因为交叉编译php的时候只选择cgi,所以配置的过程 * 中遇到问题,还有就是没注意到要将php-cgi跑起来才行,之前通过busybox httpd是 * 不需要这么做的。 * * 2016-9-26 深圳 南山平山村 曾剑锋 **************************************************************************/ 一、参考文档: 1. NGINX - No input file specified. - php Fast/CGI http://stackoverflow.com/questions/21377321/nginx-no-input-file-specified-php-fast-cgi 2. 解决NGINX PHP "No input file specified" http://xiahongyuan.blog.51cto.com/906214/852424 3. Nginx+php-cgi的配置方法介绍 http://blog.csdn.net/bookmoth/article/details/4568203 4. windows下配置nginx+php环境 http://www.cnblogs.com/huayangmeng/archive/2011/06/15/2081337.html 二、修改nginx php配置: server { listen 80; server_name localhost; root /var/www/; index index.html index.htm index.php; # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi.conf; include fastcgi_params; } } 三、启动php-cgi: 1. php-cgi -b 127.0.0.1:9000 -c /etc/php.ini 2. 开机自启动: cat /etc/init.d/S51phpCGI echo "Start php-cgi." php-cgi -b 127.0.0.1:9000 -c /etc/php.ini &
时间: 2024-10-27 13:34:26