Get the most out of your Centmin Mod LEMP stack
Become a Member

PHP-FPM Problem with PHP-FPM multiple pool

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by vahn18, Nov 7, 2014.

  1. vahn18

    vahn18 New Member

    4
    0
    1
    Nov 7, 2014
    Ratings:
    +0
    Local Time:
    5:20 AM
    Hi, I've been using Centminmod for my production server for a month now.
    It's been running flawlessly. All the tutorials are great in directing me what to do.
    I'm a beginner btw =)

    Currently my server is running PHP-FPM on port 9000 (default settings) and everything's working fine.
    The server is going to host like 8 vhosts. And I wanted to create a separated pool for some of my vhosts.

    So I'm trying to add a new pool using UNIX socket. But I got no luck.
    I keep geeting

    [error] 28271#0: *5 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, ...


    here's my setup:

    in conf/php-blogs.conf (copied from php.conf because it's working fine for the default pools)
    Code:
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #fastcgi_pass   127.0.0.1:9001;
        fastcgi_pass   unix:/tmp/phpfpm_blogs.sock;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME    $request_filename;
    ...
    }
    in conf/phpfpmd/pool_blogs.conf (copied from phpmyadmin, also because it works just fine)
    Code:
    [blogs]
    user = blogs
    group = nginx
    
    ;listen = 127.0.0.1:9001
    listen = /tmp/phpfpm_blogs.sock
    listen.allowed_clients = 127.0.0.1
    listen.owner=blogs
    listen.group=nginx
    
    pm = ondemand
    pm.max_children = 5
    ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
    pm.start_servers = 1
    pm.min_spare_servers = 1
    pm.max_spare_servers = 3
    pm.max_requests = 1000
    
    pm.process_idle_timeout = 1800s;
    
    rlimit_files = 65536
    rlimit_core = 0
    
    ;request_terminate_timeout = 0
    ;request_slowlog_timeout = 0
    slowlog = /var/log/php-fpm/blogs-slow.log
    
    security.limit_extensions = .php .php3 .php4 .php5
    
    ;php_admin_value[open_basedir] = /usr/local/nginx/html/1234_mysqladmin1234:/tmp
    php_flag[display_errors] = off
    php_admin_value[error_log] = /var/log/php-fpm/blogs-error.log
    php_admin_flag[log_errors] = on
    php_admin_value[memory_limit] = 128M
    php_admin_value[max_execution_time] = 1800
    php_admin_value[post_max_size] = 32M
    php_admin_value[upload_max_filesize] = 32M
    
    and in my vhost.conf
    Code:
    server {
      server_name domain.com www.domain.com;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/domain.com/log/access.log combined buffer=32k;
      error_log /home/nginx/domains/domain.com/log/error.log;
    
      root /home/nginx/domains/domain.com/public;
    
      location / {
    
      # block common exploits, sql injections etc
      include /usr/local/nginx/conf/block.conf;
    
      # Enable for vBulletin usage WITHOUT vbSEO installed
      try_files            $uri $uri/ /index.php;
    
      }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php_blogs.conf;
      include /usr/local/nginx/conf/drop.conf;
    }
    serving static contents work just fine.
    but when i access any php file, i just keep getting that STDERR: "Primary script unknown"
    and changin UNIX socket to port 9001 also gives me this error...

    Where did I go wrong? =(
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,178
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,138
    Local Time:
    5:20 AM
    Nginx 1.13.x
    MariaDB 5.5
  3. vahn18

    vahn18 New Member

    4
    0
    1
    Nov 7, 2014
    Ratings:
    +0
    Local Time:
    5:20 AM
    Thank you for that reference link =)