zoukankan      html  css  js  c++  java
  • nginx和php通信

    #启动php-fpm服务

    #配置nginx.conf

    worker_processes  2;
    worker_rlimit_nofile 65535;
    worker_cpu_affinity 10 01;
    
    #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  65535;
    }
    
    
    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  0;
        keepalive_timeout  65;

    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:9000; } include /usr/local/nginx/conf/vhost/*.conf;

    再配置

    server{
            listen 80;
            index index.php index.html index.htm;
            root /data/wwwroot/www.test.cc;
            location / {
                    if ( $query_string ~ "(<|%3C)") {
                            return 403;
                    }
                    if ( !-e $request_filename ) {
                            rewrite ^/(.*)$ /index.php?s=$1 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即可
  • 相关阅读:
    C#面向对象
    C#语句
    C#语言数据类型
    Jupyter Notebook(iPython)
    BeautifulSoup模块
    requests模块
    爬虫基本原理
    版本控制系统
    支付宝支付
    django内置组件——ContentTypes
  • 原文地址:https://www.cnblogs.com/300js/p/6560242.html
Copyright © 2011-2022 走看看