Nginx+FastCGI+PHP-2
来源:互联网 发布:淘宝详情模板代码 编辑:程序博客网 时间:2024/04/30 08:40
以前,一般都是在Apache上跑Php,配置:
折叠复制代码
- LoadModule php5_module modules/libphp5.so
- AddType application/x-httpd-php .php
我们现在的webserver基本都转向Nginx了,可以通过Fastcgi来跑php脚本
编译php如下:
折叠复制代码
- #编译php,注意需要–enable-fastcgi
- ./configure –prefix=/usr/local/php –enable-sockets –with-config-file-scan-dir=/opt/work/conf/ –with-config-file-path=/opt/work/conf/php.ini –with-mysql=/usr/local/mysql –with-gd=/usr/local/php/gd –with-freetype-dir=/usr/local/php/freetype –with-jpeg-dir=/usr/local/php/jpeg –enable-gd-native-ttf –enable-mbstring –with-png-dir=/usr/local/php/libpng –enable-safe-mode –enable-fastcgi
下载一个spawn-fcgi,使用它来管理php的fastcgi进程
启动脚本:
折叠复制代码
- pgrep -f php-cgi | xargs kill -9
- sleep 2
- /opt/work/sbin/spawn-fcgi -a 127.0.0.1 -p 9000 -u nobody -f /usr/local/php/bin/php-cgi
- ps -ef | grep php-cgi
配置Nginx:
折叠复制代码
- # 配置Nginx
- location ~ .*.(php|php5)?$
- {
- root /opt/work/html;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_index index.php;
- include /opt/work/conf/fastcgi_params;
- }
注意:需要有fastcgi_param SCRIPT_FILENAME这个配置,php的fastcgi使用它来确定脚本的路径,否则访问nginx会报:No input file specified
0 0
- Nginx+FastCGI+PHP-2
- nginx php fastcgi
- nginx php fastCGI配置
- nginx与php(fastcgi)
- Nginx fastcgi模式 配置 php
- Nginx+PHP(FastCGI)环境搭建
- php显示memcache状态(nginx+php fastcgi)
- Nginx和php,FastCGI和php-fpm
- [服务器] 体验 Nginx + PHP FastCGI + MySQL
- Debian 下搭建php-fastcgi方式,nginx
- Nginx + PHP(FastCGI)”Web服务器
- Ubuntu 9.04 server安装nginx+php(fastcgi)
- Windows+Nginx+PHP(FastCGI)+MYSQL 整理
- 架构 Varnish+Nginx+PHP(FastCGI)+MYSQL5+MemCache
- Nginx & PHP via FastCGI important security issue
- Ubuntu下安装Nginx+PHP+MySQL+FastCGI
- Nginx+PHP FastCgi大幅度优化提速
- nginx,php通过fastcgi连接示意图
- 【Leetcode】Convert Sorted List to Binary Search Tree
- Mysql数据库的使用总结之ERROR 1146 (42S02)
- android之单选框
- 搭建Maven私服
- Java 技术能做什么
- Nginx+FastCGI+PHP-2
- SharedPreferences 数据共享问题
- Android中的事件处理研究
- Qt Quick实现的涂鸦程序
- eclipse常用快捷键
- 如何学习(Java)
- 重装系统后iis
- Install JVM
- PCB顶层与底层布线互换