obeckham 发表于 2018-11-14 10:05:00

nginx+php-fpm动静分离

upstream phpCluster{  
    server web-php1.life.com:9000;
  
    server web-php2.life.com:9000;
  
}
  
server {
  
    listen       8080;
  
    server_namenginx.life.com;
  
    index index.php index.html index.htm;
  
    root/home/nginx/html;
  
    charsetutf-8;
  
    location ~ .*\.(php|php5) {
  
      fastcgi_passphpCluster;
  
      fastcgi_index index.php;
  
      include fastcgi.conf;
  
      set $path_info "";
  
      set $real_script_name $fastcgi_script_name;
  
      if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
  
         set $real_script_name $1;
  
         set $path_info $2;
  
      }
  

  
      fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
  
      fastcgi_param SCRIPT_NAME $real_script_name;
  
      fastcgi_param PATH_INFO $path_info;
  
    }
  
}


页: [1]
查看完整版本: nginx+php-fpm动静分离