|
⇤ ← Revision 1 as of 2020-01-19 07:21:45
Size: 988
Comment:
|
Size: 1822
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| '''FastCGI''' is a PHP implementation of the Common Gateway Interface (CGI). It works especially well with NGINX. | '''FastCGI''' is a PHP implementation of the Common Gateway Interface (CGI). It works especially well with [[SetupNGINX|NGINX]]. |
| Line 11: | Line 11: |
| Serve `.cgi` sripts from either a dedicated top-level directory (i.e., `/srv`) or from the traditional web content directory (i.e., `/var/www`). The former may be a more attractive option if using jails or separate (often read-only) mounted partitions. | The recommendation is to either serve web content from: 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` 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. |
| Line 23: | Line 28: |
| == Install Software == | == 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 == |
| Line 30: | Line 45: |
| ---- | === PHP === |
| Line 32: | Line 47: |
| 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. | |
| Line 33: | Line 49: |
== Configuration == === PHP === |
FastCGI
FastCGI is a PHP implementation of the Common Gateway Interface (CGI). It works especially well with NGINX.
Setup Files
The recommendation is to either serve web content from:
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
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.
Write the below to cgi/test.php, under whichever directory structure you prefer.
<?php phpinfo(); ?>
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
