0

I have used a TKL AMI on an EC2 instance to quickly create a NGINX / PHP box. Details of the image are on the Amazon marketplace.

It mostly works just as I'd expect it to except for a small caveat - I don't seem to have any php-fpm conf available to me. I may or may not have misunderstood what I'd be getting on the box and I'm reluctant to install anything else as I'm trying to keep it as vanilla as possible (for various reasons.)

I have a typical nginx conf which passes php back to fcgi and I have a typical PHP (not fpm) config in a typical php.ini and associated modules (xcache, pdo, etc.)

server {
  listen 0.0.0.0:80;
  root /var/www/current/app/;
  index index.php;

  include /etc/nginx/include/php;
  try_files $uri $uri/ /forums/index.php?q=$uri;
}

The /etc/nginx/include/php is very simple;

include /etc/nginx/fastcgi_params;

location ~ \.php$ {
  # http://forum.nginx.org/read.php?2,88845,page=3
  try_files $uri =404;

  fastcgi_pass unix:/var/run/nginx/php-fastcgi.sock;
  fastcgi_index index.php;
}

As is the /etc/nginx/fastcgi_params;

fastcgi_param  SCRIPT_FILENAME    $document_root$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  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

PHP is running as a service, so its got something running.

I have no pool config. No children / max requests etc - nothing. It works in that it serves pages, but it falls over when it gets too many connections (even before load is .5.)

What am I missing? Is FCGI not the same as FPM? Do I need to install something else in order to increase available workers and requests?

UPDATE: dpkg -l php5-fpm shows no package;

un php5-fpm <none>

Christian
  • 789
  • 1
  • 13
  • 31
  • 1
    Does `dpkg -l php5-fpm` show that FPM is installed? (Line starts with `ii`) FastCGI is the protocol FPM uses to communicate with the webserver, but the vanilla `php5-cgi` SAPI can use FastCGI too. – DerfK Jul 23 '14 at 04:36
  • Thanks @DerfK - should i just install the one in apt? – Christian Jul 23 '14 at 04:46
  • Ok, I think I misunderstood, http://php-fpm.org says that fpm is an alternative to fcgi. So, that means I can just configure fcgi rather than replace it? – Christian Jul 23 '14 at 05:33
  • 1
    Using FPM or not is up to you, you'd still configure fastcgi on nginx's side either way. I would recommend installing the one in Debian if you want to keep "as vanilla as possible". – DerfK Jul 23 '14 at 14:59
  • Thanks @DerfK will use the Debian one. I appreciate your help and I'd happily accept your advice as the answer if you wanted to add it. – Christian Jul 24 '14 at 06:08

0 Answers0