Mastering Nginx

(Ron) #1
Chapter 6

[ 141 ]

Variable Name Value
$status The response's status.
$tcpinfo_rtt
$tcpinfo_rttvar
$tcpinfo_snd_cwnd
$tcpinfo_rcv_space

If a system supports the TCP_INFO socket
option, these variables will be filled with the
relevant information.

$uri The normalized URI of the current request.

Using NGINX with PHP-FPM


Apache has long been considered the only option for serving PHP websites because


the mod_php Apache module makes integrating PHP directly into the web server an
easy task. With PHP-FPM being accepted into PHP's core, there is now an alternative


bundled with the PHP distribution. PHP-FPM is a way of running PHP under a


FastCGI server. The PHP-FPM master process takes care of spawning workers,
adapting to site usage, and restarting sub processes when necessary. It communicates


with other services using the FastCGI protocol. You can learn more about PHP-FPM
itself at http://php.net/manual/en/install.fpm.php.


NGINX has a fastcgi module, which is capable of communicating not only with
PHP-FPM, but also with any FastCGI-compliant server. It is enabled by default, so no


special consideration needs to be made to start using NGINX with FastCGI servers.


Table: FastCGI directives

Directive Explanation
fastcgi_buffer_size The size of the buffer used for the first part
of the response from the FastCGI server, in
which the response headers are found.
fastcgi_buffers The number and size of buffers used for the
response from a FastCGI server, for a single
connection.
fastcgi_busy_buffers_size The total size of buffer space allocated to
sending the response to the client while still
being read from the FastCGI server. This is
typically set to two fastcgi_buffers.
fastcgi_cache Defines a shared memory zone to be used
for caching.
Free download pdf