#启动php-fpm服务

#配置nginx.conf

worker_processes  ;
worker_rlimit_nofile ;
worker_cpu_affinity ; #error_log logs/error.log;
error_log /data/logs/nginx/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid; events {
use epoll;
worker_connections ;
} http {
include mime.types;
default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
tcp_nopush on;
server_tokens off; #keepalive_timeout ;
keepalive_timeout ;
gzip on;
gzip_min_length 5k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 3;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
  
upstream server_mango {
server 127.0.0.1:;
}
include /usr/local/nginx/conf/vhost/*.conf;

再配置

server{
listen ;
index index.php index.html index.htm;
root /data/wwwroot/www.test.cc;
location / {
if ( $query_string ~ "(<|%3C)") {
return ;
}
if ( !-e $request_filename ) {
rewrite ^/(.*)$ /index.php?s=$ last;
break;
}
}
location "\.(jpeg|jpg|png|gif|css|js|ico|swf)" {
expires 8h;
} location ~ "\.php$" {
include fastcgi_params;
fastcgi_pass server_mango;
} }

再编辑:

include fastcgi_params; 
添加 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 启动nginx即可

nginx和php通信的更多相关文章

  1. nginx配置:支持phpfastcgi,nginx和php-cgi通信,部分nginx常量解释

    支持phpfastcgi的配置如下: server { listen       8000; server_name  localhost; root F:/home/projects/test; i ...

  2. php与nginx之间的通信

    Nginx是俄国人最早开发的Webserver,现在已经风靡全球,相信大家并不陌生.PHP也通过二十多年的发展来到了7系列版本,更加关注性能.这对搭档在最近这些年,叱咤风云,基本上LNMP成了当下的标 ...

  3. nginx和php-fpm通信的两种方式 unix socket和TCP

    nginx和fastcgi的通信方式有两种,一种是TCP 一种是unix socket TCP使用的是 127.0.0.1:9000端口,将fastcgi_pass参数修改为127.0.0.1:900 ...

  4. nginx配置:支持phpfastcgi,nginx和php-cgi通信,部分nginx常量解释

    支持phpfastcgi的配置如下: server { listen 8000; server_name localhost; root F:/home/projects/test; index in ...

  5. 【转】nginx 和 php-fpm 通信使用unix socket还是TCP,及其配置

    原文: http://blog.csdn.net/pcyph/article/details/46513521 -------------------------------------------- ...

  6. Nginx与PHP交互过程 + Nginx与PHP通信的两种方式

    一.Nginx与PHP交互过程的7步走(用户对动态PHP网页访问过程) step1:用户将http请求发送给nginx服务器(用户和nginx服务器进行三次握手进行TCP连接) step2:nginx ...

  7. nginx与php-fpm通信的两种方式

    简述 在linux中,nginx服务器和php-fpm可以通过tcp socket和unix socket两种方式实现. unix socket是一种终端,可以使同一台操作系统上的两个或多个进程进行数 ...

  8. PHP-FPM 与 Nginx 的通信机制总结

    PHP-FPM 介绍   CGI 协议与 FastCGI 协议 每种动态语言( PHP,Python 等)的代码文件需要通过对应的解析器才能被服务器识别,而 CGI 协议就是用来使解释器与服务器可以互 ...

  9. 【高级】PHP-FPM和Nginx的通信机制

    PHP-FPM 介绍 CGI 协议与 FastCGI 协议 每种动态语言( PHP,Python 等)的代码文件需要通过对应的解析器才能被服务器识别,而 CGI 协议就是用来使解释器与服务器可以互相通 ...

随机推荐

  1. stm32启动地址

    理论上,CM3中规定上电后CPU是从0地址开始执行,但是这里中断向量表却被烧写在0x0800 0000地址里(Flash memory启动方式),那启动时不就找不到中断向量表了?既然CM3定下的规矩是 ...

  2. 03009_HttpServletResponse

    1.HttpServletResponse概述 (1)我们在创建Servlet时会覆盖service()方法,或doGet()/doPost(),这些方法都有两个参数,一个为代表请求的request和 ...

  3. HashMap的C++实现

    #include <iostream> #include <cstring> #include <string> typedef unsigned int SIZE ...

  4. Leetcode4--->求两个排序数组的中位数

    题目:给定两个排序数组,求两个排序数组的中位数,要求时间复杂度为O(log(m+n)) 举例: Example 1: nums1 = [1, 3] nums2 = [2] The median is ...

  5. python-高级编程-01

    [1] 列表推导 问题 我们需要一个[2,4,6,8] 这样的列表 传统写法 res = [] for i in range(10): if i %2 == 0:res.append(i) print ...

  6. 设计模式之工厂模式 Factory实现

    simpleFactory //car接口 public interface Car { void run(); } //两个实现类 public class Audi implements Car{ ...

  7. python递归深度报错--RuntimeError: maximum recursion depth exceeded

    当你的程序递归的次数超过999次的时候,就会引发RuntimeError: maximum recursion depth exceeded. 解决方法两个: 1.增加系统的递归调用的次数: impo ...

  8. pip install ImportError: cannot import name main

    在Ubuntu上用pip install装ansible时报错 root@user:~# pip install --no-cache-dir ansible -i http://mirrors.al ...

  9. 【Istio】error initializing configuration '/etc/istio/proxy/envoy-rev0.json': malformed IP address: istio-statsd-prom-bridge

    今天遇到一个问题,istio的组件一直在重启,查看log大概是这个样子 --03T07::.935580Z info Epoch starting --03T07::.936317Z info Env ...

  10. classpath路径

    在项目被集成开发环境编译后,src目录下的东西会编译到WEB-INF/classes目录下,而WEB-INF/classes目录就是所谓的classpath. 将数据库连接配置dataSource.x ...