Home >Backend Development >PHP7 >How to configure nginx and php-fpm
In php7, the most indispensable ones are nginx and php-fpm. Today I will show you how to configure nginx and php-fpm. You can refer to it if you need it.
0: Turn off the firewall first!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1: Compile and install php nginx No introduction;
2: After installing php, not only must you put the php.ini in the source package to the corresponding location (mine is in /usr/local/php/ lib/, do not specify the location for compilation and installation, just put it here, pay attention), and also put php-fpm in the source package under /usr/local/bin;
Source code compilation
./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip
2.2 Place php-fpm under /usr/local/bin, and then run
3: Add A user group groupadd www-data
Add a user to this group useradd -g www-data (group name) www-data (user name)
4: Put the php.ini file below cgi.fix_pathinfo is changed to 0
5: The configuration file of php-fpm.conf is installed in the /usr/local/php/etc directory by default;
Copy: cp /usr/lcoal/php/etc/php-fpm.conf .default /usr/local/php/etc/php-fpm.conf
The above is the detailed content of How to configure nginx and php-fpm. For more information, please follow other related articles on the PHP Chinese website!