помогите разобраться с загрузкой nginx + php_fmp

vit slipchenko vvs at vs.kiev.ua
Tue Nov 11 16:24:03 MSK 2008


Всем добрый день.

Помогите разобраться с nginx + php_fpm !

при этой связке php-cgi порождает большое кол-во процессов, сжирает всю
память и cpu и все равно не обрабатывает все запросы. 


хотя связка nginx -> apache + mod_php справляется.

конфиг nginx

=============================================
user  www www;

worker_processes 4;

worker_rlimit_nofile 51200;

events {
    worker_connections 51200;
        use kqueue;
}

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;
    access_log off
    reset_timedout_connection on;
    sendfile         on;
    tcp_nopush       on;
    tcp_nodelay      on;
    send_lowat       12000;

    keepalive_timeout  10;

    gzip  on;
    gzip_min_length  1100;
    gzip_buffers     4 8k;
    gzip_types       text/plain;

#   fastcgi_intercept_errors off;

    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 128k;

    server {
      listen       XXX.XXX.XXX.XXX:80;
      server_name  forum.site.com;
      charset      windows-1251;

location / {

rewrite ^/((urllist|sitemap_).*\.(xml|
txt)(\.gz)?)$ /vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;

if ($request_filename ~ "\.php$" ) {
         rewrite ^(.*)$ /vbseo.php last;
   }

   if (!-e $request_filename) {
         rewrite ^/(.*)$ /vbseo.php last;
   }

}

location ~ \.php$ {
          fastcgi_pass   127.0.0.1:9000; 
          fastcgi_index  index.php;
          fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
          fastcgi_param  SERVER_SOFTWARE    nginx;
          fastcgi_param
SCRIPT_FILENAME  /usr/local/www/data/site.com/forums
$fastcgi_script_name;

          fastcgi_param  QUERY_STRING     $query_string;
          fastcgi_param  REQUEST_METHOD   $request_method;
          fastcgi_param  CONTENT_TYPE     $content_type;
          fastcgi_param  CONTENT_LENGTH   $content_length;
          fastcgi_param  SCRIPT_NAME      $fastcgi_script_name;

          fastcgi_param
DOCUMENT_ROOT    /usr/local/www/data/site.com/forums;

          fastcgi_param  SERVER_NAME      $server_name;
          fastcgi_param  REQUEST_URI      $request_uri;
          fastcgi_param  REMOTE_USER      $remote_user;
          fastcgi_param  REMOTE_ADDR      $remote_addr;
          fastcgi_param  REMOTE_PORT      $remote_port;
} #end location php

} #end server forum.site.com

==========================================================================


в конфиге php-fpm.conf
менялось только 

Unix user of processes
<value name="user">www</value>                          

Unix group of processes
<value name="group">www</value> 

<value name="apache_like">
    <value name="StartServers">20</value>
    <value name="MinSpareServers">5</value>
    <value name="MaxSpareServers">35</value>
</value>

-- 
Regards,
Vit

-=> http://www.sat-expert.com 
-=> ICQ 777874
-=> Skype: lazy-seal
-=> My PGP pub keys http://www.sat-expert.com/vvs-pub.asc








More information about the nginx-ru mailing list