search
HomeBackend DevelopmentPHP7How to configure nginx and php-fpm

How to configure nginx and php-fpm

Jul 13, 2021 am 09:18 AM
nginxphp-fpmConfiguration

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.

How to configure nginx and php-fpm

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

##6; Edit php-fpm.conf

A: Change php-fpm to background running mode

B: Change the www- data (group) www-data (user) is added to this configuration file. However, this configuration file may not exist. Then look down

C: It is introduced here Another configuration file, in the /usr/local/php/etc/php-fpm.d folder,

execute: cp /usr/local/php/etc/php-fpm.d/www. conf.default /usr/local/php/etc/php-fpm.d/www.conf

D: vim www.conf, change user and group to just Created www-data

7: Edit nginx.conf

vim /usr/local/nginx/config/nginx.conf

Change to this: For specific tutorials, search online

8: Write a phpinfo.php file in the root directory and test

!!!!!! !!!!!!!!!!!!Turn off the firewall!!!!!!!!!!!!!!!!!!

!!!!!!!!!!!! !!!All configuration files must be restarted after changing them!!!!!!!!!!

centos7 close the firewall

//Temporarily close systemctl stop firewalld

//Disable starting systemctl disable firewalld at boot

9: Restart the configuration file as follows

To add php nginx mysql to the service, please refer to the following

https://blog.csdn.net /ijijni/article/details/78513521

#Recommended learning:

php video tutorial

10: Visit page phpinfo page

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!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version