Size: 1822
Comment:
|
Size: 784
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= FastCGI = | = PHP-FPM = |
Line 3: | Line 3: |
'''FastCGI''' is a PHP implementation of the Common Gateway Interface (CGI). It works especially well with [[SetupNGINX|NGINX]]. | The PHP '''FastCGI Process Manager''' ('''PHP-FPM''') is an implementation of the [[Protocols/CGI|FastCGI]] specification. <<TableOfContents>> |
Line 9: | Line 11: |
== Setup Files == | == Installation == |
Line 11: | Line 13: |
The recommendation is to either serve web content from: | PHP-FPM naturally depends on `php(1)`. See [[PHP#Installation|here]] for help with installation, and [[PHP/Configuration|here]] for help with configuration. |
Line 13: | Line 15: |
A. a dedicated top-level directory (such as `/srv`) that can be ''easily'' separately-mounted with special settings (i.e. `ro`--the read-only fstab option) B. the traditional web content directory, `/var/www` |
Most Linux and BSD distributions will offer a `php-fpm` package. |
Line 16: | Line 17: |
Note that any directory can be a mounted device, but there are complications with applying special settings to directories that many package managers expect to be able to write to. | Official container images are available from the upstream development team. They are tagged like `php:<version>-fpm` |
Line 18: | Line 19: |
Write the below to `cgi/test.php`, under whichever directory structure you prefer. | ---- == Configuration == As a security measure, the allowable extensions should be set as strictly as possible. |
Line 21: | Line 28: |
<?php phpinfo(); ?> | security.limit_extensions = .php .html .htm |
Line 28: | Line 35: |
== Setup User == Linux permissions and restrictions are most easily done through users, groups, and umasks. The recommendation is to set a specific user and group for the web service. The common options are `www-data` (Apache) and `http` (PHP). Depending on your ditro, these users and groups may already be created. See details on running `useradd` and `groupadd` in UserSetup. ---- == Setup Software == At a minimum, we need: php, php-fpm, fcgi, fcgiwrap, and nginx. Common additional tools include: * apache2-utils (a.k.a. apache-tools, httpd-utils, etc.) for creating .htpasswd files for basic restrictions === PHP === The primary configuration for PHP is found in `/etc/php/php.ini`. Some distributions carry two versions--`php.ini-production` which is more secure and `php.ini-development` which is more backwards-compatible. Chuck the latter straight into the bin. === PHP-FPM === === FastCGI === === NGINX === ---- == Startup == ---- == Maintenance == |
== Usage == |
PHP-FPM
The PHP FastCGI Process Manager (PHP-FPM) is an implementation of the FastCGI specification.
Contents
Installation
PHP-FPM naturally depends on php(1). See here for help with installation, and here for help with configuration.
Most Linux and BSD distributions will offer a php-fpm package.
Official container images are available from the upstream development team. They are tagged like php:<version>-fpm
Configuration
As a security measure, the allowable extensions should be set as strictly as possible.
security.limit_extensions = .php .html .htm