[Linux]PHP-FPM与NGINX的两种通讯方式
一、通过监听TCP端口通讯
php-fpm.d/www.conf
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:
nignx.conf
location ~ \.php {
root /lroot/wwwroot/test;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
二、通过unix socket进程间通讯
通过配置php-fpm.d/www.conf Listen 项,php-fpm主进程启动时会在这个目录创建一个sock文件,例如/run/php-fpm.sock(注意不应选用/tmp目录)
php-fpm.d/www.conf
1.设置通讯方式
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /run/php-fpm.sock
2.设置创建.sock文件的访问权限,以便nginx进程能够访问php-fpm创建的.sock
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = nginx
group = nginx
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to
listen.owner = nginx
listen.group = nginx
listen.mode =
nignx.conf
location ~ \.php {
root /lroot/wwwroot/test;
fastcgi_pass unix:/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
[Linux]PHP-FPM与NGINX的两种通讯方式的更多相关文章
- Nginx 的两种认证方式
简介: 今天来研究一下 Nginx 的两种认证方式. 1.auth_basic 本机认证 2.ngx_http_auth_request_module 第三方认证 一.安装 Nginx shell & ...
- php 与 nginx 的两种处理方式
1.IP:Port 监听方式 php-fpm docker pull PHP:2.4-alpine nginx.conf fastcgi_pass 127.0.0.1:9000; php-fpm 在容 ...
- MySQL数据库的两种连接方式:TCP/IP和Socket
Linux平台环境下主要有两种连接方式,一种是TCP/IP连接方式,另一种就是socket连接. 在Windows平台下,有name pipe和share memory(不考虑)两种. TCP/IP连 ...
- linux访问windows共享文件夹的两种方法
有时需要在linux下需要访问windows的共享文件夹,可以使用mount挂载或者使用samba连接. 1.mount挂载 首先创建被挂载的目录: $ mkdir windows 将共享文件夹挂载到 ...
- Nginx 和 PHP 的两种部署方式比较
2种部署方式简介 第一种 前置1台nginx服务器做HTTP反向代理和负载均衡 后面多态服务器部署Nginx Web服务和php-fpm提供的fast cgi服务 第二种 前置1台nginx服务器做W ...
- (转)linux访问windows共享文件夹的两种方法
有时需要在linux下访问window的共享文件,可以使用mount挂载或使用samba连接. 1,mount挂载 $ mkdir windows 将共享文件夹挂载到windows文件夹: mount ...
- Linux 下wdcp支持两种安装方式
wdcp支持两种安装方式1 源码编译 此安装比较麻烦和耗时,一般是20分钟至一个小时不等,具体视机器配置情况而定2 RPM包安装 简单快速,下载快的话,几分钟就可以完成源码安装(ssh登录服务器,执行 ...
- linux服务器上安装jdk8的两种方法
这里介绍两种安装方式: yum安装(力荐) 从官网下载包安装 获得一台linux服务器 要在linux下安装jdk,首先你得先有一台linux服务器,虚拟机或者租一台都可以 yum安装jdk 在l ...
- Docker + .NET Core(三)-两种发布方式
原文:Docker + .NET Core(三)-两种发布方式 第一种,自己手写dockerfile发布,上传至hubDocker 正常发布到文件夹中,发布文件上传至linux机器上.如 /www/a ...
随机推荐
- C#利用Guid实现真随机数
C#中的随机数可以利用Random类很简单地生成随机数,代码如下: Random rdmNum=new Random();//生成随机数对象 int ans=rdmNum.Next(a,b);//生成 ...
- SSH整合方案二(不带hibernate.cfg.xml)
整体结构: 1.引入相关jar包 2.编写实体类和映射文件 package cn.zqr.domain; public class Customer { private Long cust_id; p ...
- Linux 下时间获取
1.获得当天的日期 date +%Y-%m-%d 2.将当前日期赋值给DATE变量 DATE=$(date +%Y%m%d) 3.获取明天的日期 date -d next-day +%Y%m%d 4. ...
- C++ 模态与非模态对话框
视频教程:模态与非模态对话框1 模态对话框:子窗口关闭之前,不能对父窗口操作 非模态对话框:子窗口关闭之前,可以对父窗口操作 插入一个对话框: 资源视图--->右击---> 进行类的绑定: ...
- remove() 方法
jQuery的 remove() 方法,去掉选中元素. 例如: $("button").click(function(){ $("p").remove(); } ...
- 集成JUnit测试错误java.lang.IllegalStateException: Failed to load ApplicationContext
1 详细错误信息 java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.t ...
- Ant使用指南
ant 使用指南 参考:http://www.cnblogs.com/hoojo/archive/2013/06/14/java_ant_project_target_task_run.html 一 ...
- 下载最新的glibc库并临时使用,而不污染原有系统环境
以下参考了文中提到的博文,那篇博文其中有他安装时报错的内容,以及如何解决的,特别是报错2,值得学习借鉴 另外升级glibc,这篇文章有补充https://blog.csdn.net/fzuzhangh ...
- java spring属性注入
一.创建对象时候,向类里面属性设置值:一般有三个方式 1) .有参构造, 2). set**** 3).接口注入 二. 在spring框架里面,支持前面两种方式: 1).有参构造方法 用constr ...
- bootstrap-table前端修改后台传来的数据重新进行渲染
使用bootstrap-table显示数据,后台传回数据以后,可能需要对其做调整,如需要前端为数据添加单位 回到顶部 调整数据代码 $("#"+tableId).bootstrap ...