Home > Article > Backend Development > Introduction to the organizational structure of nginx+php-fpm configuration file_PHP tutorial
1.nginx configuration file path
Generally speaking, when installing nginx, the default path of the configuration file is /usr/local/nginx/conf/nginx.conf.
We can use a link file to point the conf directory to a specific directory to facilitate management. For example, the author's company likes to centralize all server configuration files in /home/server_config, then create a new subdirectory nginx in this directory, and then point /usr/local/nginx/conf to /home/server_config through the link file /nginx.
2. Virtual host configuration file path
Usually, the author’s company will write the configuration file of each Virtualhost into a separate file. These separate files live in separate projects.
But there is a trick. We can create a subdirectory include in the directory where nginx.conf is located. Under the include directory, there are a series of link files that point to the Virtualhost configuration file.
3.php-fpm configuration file path
Usually, the php-fpm execution file is in the sbin directory under the php installation path. (Here, there is a digression. When installing PHP, the installation directory generally defaults to /usr/local. This is not a good choice, because sometimes, multiple versions of PHP may need to exist on one server at the same time. A A good implementation is to install different versions of php in /usr/local/php-xxx/, where xxx represents the version of php).
The configuration file of php-fpm is placed in the etc directory under the php installation path by default. But in fact, the configuration file of php-fpm can specify the path when starting php-fpm, and different php-fpm instances can specify different configuration files. And this also has practical significance: Nginx may be monitoring multiple VirtualHosts at the same time on one server. When restarting a Host, you only need to restart the corresponding php-fpm instance.
4. The configuration file path of each pool
can be specified by yourself. But generally, we will manage it centrally. The author's company chose to place it under /var/run and create a folder for each instance. In addition to php-fpm, the folder also contains the corresponding pid file and the corresponding unix:socket file. .