nginx和fastcgi的两种通信方式

简介: nginx和fastcgi的两种通信方式

nginx和fastcgi的通信方式有两种

1、TCP:

# 1、nginx
location ~ \.php$ {
      index index.php index.html index.htm;
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      include fastcgi_params;
 }
# 2、php-fpm
listen=127.0.0.1:9000

2、unix domain socket:

# 1、新建fpm-cgi.sock
sudo touch /dev/shm/fpm-cgi.sock
sudo chown www-data:www-data /dev/shm/fpm-cgi.sock
sudo chmod 666 /dev/shm/fpm-cgi.sock
# 2、php-fpm
listen=/dev/shm/fpm-cgi.sock
listen.backlog = -1
# 3、nginx
location~\.php${
      index index.php index.html index.htm;
      include /etc/nginx/fastcgi_params;
      fastcgi_pass unix:/dev/shm/fpm-cgi.sock;
      fastcgi_index index.php;
      include fastcgi_params;
}

参考

nginx 和 php-fpm 通信使用unix socket还是TCP,及其配置

相关文章
|
11月前
|
存储 应用服务中间件 Linux
nginx配置证书和私钥进行SSL通信验证
nginx配置证书和私钥进行SSL通信验证
547 4
|
Cloud Native 应用服务中间件 Go
深入解析:探索Nginx与Feign交锋的背后故事 - 如何优雅解决微服务通信中的`301 Moved Permanently`之谜!
深入解析:探索Nginx与Feign交锋的背后故事 - 如何优雅解决微服务通信中的`301 Moved Permanently`之谜!
245 0
|
应用服务中间件 nginx 数据中心
理解Registrator、Nginx、Consul架构与SpringCloud Feign、grpc、rest通信之间的不同点
在互联网应用领域,服务的动态性需求十分常见,这就对服务的自动发现和可动态扩展提出了很高的要求。
433 0
|
应用服务中间件 PHP Apache
nginx、fastcgi、php-fpm
什么是fastcgi? fastCGI是由CGI(common gateway interface,通用网关接口)发展而来,是http服务器(nginx、apache)和动态脚本语言(php)之间的通信接口。记住,fastCGI只是一个接口。
|
应用服务中间件 Linux nginx
Nginx进程间的通信机制
Nginx进程间的通信机制
340 0
Nginx进程间的通信机制
|
负载均衡 Java 应用服务中间件
[CGI,Nginx,FastCGI,编程语言,服务器端]FastCGI在PHP与Nginx之间的作用介绍
  一:什么是 CGI?   服务器端编程语言如(如php/java)与Web服务器之间传递信息的协议,约定了http头、表单等信息的传递接口;   二:FastCGI 是什么?
229 0
|
缓存 应用服务中间件 PHP
nginx的fastcgi模块配置与php-fpm配置记录
nginx的fastcgi模块配置与php-fpm配置记录
3866 0
nginx的fastcgi模块配置与php-fpm配置记录
|
应用服务中间件 PHP nginx
Nginx之6大千世界 - (FastCGI)
Nginx从入门到深入之FastCGI
1551 0
|
应用服务中间件 PHP C++