• 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即可
  • 相关阅读:
    [LeetCode] Contains Duplicate II
    [LeetCode] House Robber II
    [LeetCode] Permutations II
    [LeetCode] Permutations
    [LeetCode] Next Permutation
    谈谈套接字
    基于Linux系统的Nagios网络管理模块的实现
    Windows/Linux下磁盘使用的图形化工具简介
    利用日志使管理Linux更轻松
    实际感受美丽的Linux(多组视频)
  • 原文地址:https://www.cnblogs.com/300js/p/6560242.html
Copyright © 2020-2023  润新知