Search code examples
phpnginxserverfpm

How does nginx server processes a PHP request?


Can anyone explain the entire process, I have just begun to understand the process. I understand how an Apache server processes the request.

How does nginx server processes the request and how is it different from the Apache server?


Solution

  • enter image description hereNginx does not process a PHP request. Nginx is a web server that processes a HTTP request and pass it to the upstream application server; for example php-fpm. PHP FPM is the application server that processes the request and generate HTTP response from PHP scripts and pass it to Nginx and Nginx sends the response back to the user.

    If we replace Nginx with Apache the scenario doesn't change. Apache has a PHP module for passing the request to PHP and get the results back.

    Nginx PHP-FPM process