如何使用NGINX配置PHP-FPM

PHP-FPM (FastCGI Process Manager) is an alternative to FastCGI implementation of PHP with some additional features useful for sites with high traffic. It is the preferred method of processing PHP pages with NGINX and is faster than traditional CGI based methods such as SUPHP or mod_php for running a PHP script.

PHP-FPM (FastCGI流程管理器)是PHP的FastCGI实现的替代方法,具有一些附加功能,可用于高流量站点。 它是使用NGINX处理PHP页面的首选方法,并且比传统的基于CGI的方法(例如SUPHPmod_php运行PHP脚本要快。

The main advantage of using PHP-FPM is that it uses a considerable amount of less memory and CPU as compared with any other methods of running PHP. The primary reason is that it demonizes PHP, thereby transforming it to a background process while providing a CLI script for managing PHP request.

使用PHP-FPM的主要优点是,与运行PHP的任何其他方法相比,它使用大量的内存和CPU。 主要原因是它妖魔化了PHP,从而将其转换为后台进程,同时提供了用于管理PHP请求的CLI脚本。

PHP-FPM NGINX配置先决条件 (PHP-FPM NGINX Configuration Prerequisites)

  • You can open a SSH session to your Ubuntu 18.04 system using root or a sudo enabled user.

    您可以使用root或启用sudo的用户打开到Ubuntu 18.04系统的SSH会话。
  • You have already installed NGINX and PHP in your Ubuntu 18.04 system.

    您已经在Ubuntu 18.04系统中安装了NGINX和PHP。

NGINX PHP-FPM配置步骤 (NGINX PHP-FPM Configuration Steps)

  • Install PHP-FPM

    安装PHP-FPM
  • Configure PHP-FPM Pool

    配置PHP-FPM池
  • Configure NGINX for PHP-FPM

    为PHP-FPM配置NGINX
  • Test NGINX PHP-FPM Configuration

    测试NGINX PHP-FPM配置

1.安装PHP-FPM (1. Install PHP-FPM)

Nginx doesn’t know how to run a PHP script of its own. It needs a PHP module like PHP-FPM to efficiently manage PHP scripts. PHP-FPM, on the other hand, runs outside the NGINX environment by creating its own process. Therefore when a user requests a PHP page the nginx server will pass the request to PHP

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值