fastcgi

fastcgi

fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/path/to/php-fpm.sock;

fastcgi_param

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;    一般只需要这个
include fastcgi_params;                                   其他的参数都写在这个文件中了
fastcgi_pass_header X-Forwarded-For   显示 header
fastcgi_hide_header X-Forwarded-For   隐藏 header
fastcgi_index index.php;

fastcgi_split_path_info
如果访问: http://localhost/index.php/Home/Index/index.html

location ~ \.php {
    fastcgi_split_path_info ^(.*\.php)(.*)$;
    # 经过上面的配置之后, $fastcgi_script_name 就会变成 /index.php, $fastcgi_path_info 就会变成 /Home/Index/index.html
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
}

另一种配置 path_info 方式

location ~ (.*\.php)(.*)$ {
    fastcgi_param SCRIPT_FILENAME $document_root$1;
    fastcgi_param PATH_INFO $2;
}

buffer

fastcgi_buffers 8 4k;            8 个 buffer, 每个 4k
fastcgi_buffer_size 4k;          默认和上面的一样
fastcgi_next_upstream    error | timeout | invalid_header | off

cache 控制

时间: 2024-08-03 15:53:05

fastcgi的相关文章

基于lamp+fastcgi+https搭建phpMyAdmin和wordpress

前言: lamp为网站搭建的很基本的一个架构,如果仅仅只是静态的网页文件,我们就可以通过基本的web服务器来处理.当我们需要处理动态内容时,比如把用户数据放在数据库,从数据库取出数据等等,我们就必须借助CGI连接到处理动态请求的应用.FastCGI作为一个常驻型的CGI,可以独立于apache服务,可以实现分布式的部署.接下来我们用一台 主机来搭建phpMyAdmin和wordpress,并且让wordpress实现https. 正文: 部署之前我们先简单介绍下我们用到的架构,不用多说lamp就

Nginx+PHP (Fastcgi)常见502和504解决思路分享

公司一台测试服务器,最近出现504和502问题:(环境LNMP,php编译安装,Fastcgi模式),问题不难解决,但这里分享一下自己的排查思路和处理问题的方式. 504 Gateway Time-out,nginx 502 bad gateway 一.分析问题: Nginx 504 Gateway Time-out的含义是没有请求到可以执行的PHP-CGI. Nginx 502 Bad Gateway的含义是请求的PHP-CGI已经执行,但是由于读取资源的等没有执行完毕而导致PHP-CGI进程

LAMP基于FastCGI分离部署应用

实验目标 本次LAMP搭建在CentOS 7虚拟机上,基于 php-fpm(Fastcgi)实现httpd.php-fpm.mariadb三者分离,并且在LAMP上部署应用,用两个虚拟机一个虚拟主机用于提供phpMyAdmin:另一个虚拟主机用于提供wordpress:且提供 xcache加速. 实验环境部署如下: httpd 172.18.12.7 httpd-2.4.6-40.el7.centos.x86_64 php-fpm 172.18.12.8 php-fpm-5.4.16-36.el

PHP以FastCGI方式与LAMP整合

1.系统环境: [[email protected] ~]# cat /etc/issue CentOS release 6.4 (Final) Kernel \r on an \m   [[email protected] ~]# uname -r 2.6.32-358.el6.x86_64 [[email protected] ~]# ifconfig | grep Bcast:           inet addr:192.168.0.200  Bcast:192.168.0.255  

apache/mysql/php编译安装及支持xcache和fastcgi方式运行

一.编译安装apache     1.安装环境:yum install gcc gcc-c++ openssl-devel libtool -y     2.安装apr.apr-util及pcre         tar jxf apr-1.5.1.tar.bz2         cd apr-1.5.1         ./configure --prefix=/usr/local/apr         make && make install              tar jxf

fastcgi_params 与 fastcgi.conf的差异

fastcgi.conf 对比下fastcgi.conf与fastcgi_params文件,可以看出只有以下差异: Java代码   tctq4master@ddd:/etc/nginx$ diff fastcgi.conf  fastcgi_params 2d1 < fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name; 25a25,26 > > fastcgi_param  SCRIPT_FILENA

PHP中的FastCGI初识

FastCGI初始: http://www.cnblogs.com/JohnABC/p/3529786.html PHP中fastcgi的实现: 1.开启一个socket监听服务 fcgi_fd=fcgi_listen(); 完成socket.bind.listen三步 2.初始化请求对象 fcgi_init_request(&request,fcgi_fd); struct fcgi_request{ int listen_socket; int fd, int id; int keep; i

CGI,FastCGI,PHP-CGI,PHP-FPM,Spawn-FCGI

CGI CGI, Common Gateway Interface, is a tool for HTTP server to contact with programs on other servers, which can be used into any languages with standard input, standard output and environmental variables, such as PHP, Perl, or Tcl. FastCGI FastCGI 

Nginx FastCGI的运行原理

一.FastCGI 1.介绍 CGI全称通用网关接口 Commmon Gateway Interface 用于HTTP服务上的程序服务通信交流的一种工具,CGI程序须运行在网络服务器上. 传统CGI接口方式性能较差,由于每次HTTP服务器遇到动态程序需要重启解析器来执行解析,然后结果被返回给HTTP服务器.这在处理高并发时,几乎是不可能的,因此诞生了FastCGI.另外传统的CGI接口方式安全性也很差 一个可伸缩地.高速地在HTTP服务器和动态脚本语言间通信的接口 接口在linux下是socke

Nginx使用教程(六):使用Nginx缓存之FastCGI缓存

启用FastCGI缓存 <br\>编辑必须启用缓存的虚拟主机配置文件. nano /etc/nginx/sites-enabled/vhost 将以下行添加到server{}指令之外的文件顶部: fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m; fastcgi_cache_key "$scheme$request_method$host$request_uri"