NGINX Cookbook
上QQ阅读APP看书,第一时间看更新

Getting ready

To compile PHP code and run it via NGINX, the preferred method is via PHP-FPM, a high-speed FastCGI Process Manager. We'll also need to install PHP itself and, for the sake of simplicity, we'll stick with the OS-supplied version. Those seeking the highest possible performance should ensure they're running PHP 7 (released December 3, 2015), which can offer a 2-3 times speed improvement for WordPress, while at the same time being up to four times more memory efficient compared to PHP 5.6.

To install PHP-FPM, you should run the following on a Debian/Ubuntu system:

apt-get install php7.0-fpm

For those running CentOS/RHEL, you should run the following:

sudo yum install php-fpm 

As PHP itself is a prerequisite for the php-fpm packages, it will also be installed.

Note: Other packages such as MySQL will be required if you're intending to run this on a single VPS instance. Consult the WordPress documentation for a full list of requirements.