Home >Backend Development >PHP Tutorial >LNMP environment construction (2) Integrating Nginx and PHP
There are many ways to install Nginx. Here we compile the source code for installation and use the following commands:
If the following error occurs during the installation process:
You need to install PCRE first:
Installation After completion, the Nginx installation directory is /usr/local/nginx.
Next, modify the nginx configuration file (/usr/local/nginx/conf/nginx.conf) so that it can handle PHP scripts:
Finally, when starting Nginx, you need to first Start PHP-FPM.
For Nginx restart and shutdown operations, you can use the following commands:
And PHP-FPM It is more troublesome. You need to use ps -ef | grep php-fpm to get the process ID of the master process, and then use kill -USR2:
Note: -USR2 parameter is restart, -INT parameter is Close
The above introduces the LNMP environment construction (2) Integrating Nginx and PHP, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.