Installation and configuration of nginx and PHP under CentOS7
Download Nginx
1. Create a new folder on the server /home/soft/ ;
2.cd /home/soft/ => Execute the command to download Nginx wget http://nginx.org/download/nginx-1.7.4.tar.gz ;
3. Unzip the downloaded compressed package to /opt/software/ => tar -zvxf nginx-1.7.4.tar.gz -C /opt/software/ ;
4.cd /opt/software/nginx-1.7.4/ => ./configure --prefix=/usr/local/nginx/ ;
5.make && make install ;
6. Start nginx => /usr/local/nginx/sbin/nginx
7. Open the browser to access the IP of this machine. If the browser displays Welcome to nginx!, it means that Nginx has been installed and run successfully.
8. Restart:/usr/local/nginx/sbin/nginx –s reload
Stop:/usr/local/nginx/sbin/nginx –s stop
Test whether the configuration file is normal:/usr/local/nginx/sbin/nginx –t
Force shutdown: pkill nginx
Download php
1. cd /home/soft/ Download php: wget https://www.php.net/distributions/php-7.2.25.tar.gz;
2. Unzip php-7.2.25.tar.gz => tar -zvxf php-7.2.25.tar.gz -C /opt/software/ ;
3. cd /opt/software/php-7.2.25/;
4. First install the dependencies required for php:
Yum update
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel
yum -y install curl-devel
yum -y install libxslt-devel
yum install openssl openssl-devel
5. ./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-xmlrpc --with-xsl --with-zlib --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-xml --enable -zip
6. make && make install
7. PHP configuration information:
cp /opt/software/php-7.2.25/php.ini-development /usr/local/php/lib/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp -R /opt/software/php-7.2.25/sapi/fpm/php-fpm /etc/init.d/php-fpm
* It should be noted that the www.conf configuration file in php7 configures the port number and other information of phpfpm. If you modify the default 9000 port number, you need to change it here, and then change the nginx configuration
Ngin parses php:
1. Change the nginx configuration file => vim /usr/local/nginx/etc/nginx/nginx.conf
Location ~ \.php$ {
root /usr/share/nginx/html; #Specify the root directory of php
fastcgi_pass 127.0.0.1:9000; #The default port of php-fpm is 9000
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #Path
include fastcgi_params;
}
2.php configuration to start automatically at boot:
vim /usr/lib/systemd/system/php-fpm.service
[Unit]
Description=php
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/php/sbin/php-fpm
ExecStop=/bin/pkill -9 php-fpm
PrivateTmp=true
[Install]
WantedBy=multi-user.target
3. killall /etc/init.d/php-fpm
4. Start php
systemctl restart php-fpm.service
systemctl enable php-fpm.service
The above is the detailed content of How to install and configure nginx and PHP under CentOS7. For more information, please follow other related articles on the PHP Chinese website!

On December 19, a media communication meeting with Honor Internet Services with the theme of "New Ecology, New Potential Energy and New Growth" was held in Guangzhou. Sun Jianfa, director of Honor Consumer Cloud Business Department, Ren Xulong, director of Guangdong Honor Business Department, Wang Guan, director of Honor Cloud business rules and marketing, and Su Tong, director of Guangdong Honor Retail, attended the meeting and shared the development strategy of Honor Internet services, such as AI, and other technological innovations and high-quality experiences. Honor Internet Services have been newly advanced, creating a more complete Internet service ecosystem. Honor Internet Services provide full-scene Internet service experience to Honor global terminal users, empowering users to "enjoy a smarter and more high-quality digital life" with a diverse product matrix in one-stop and full link. Sun Jianfa said, "Rong

Empowering technology to benefit people's livelihood: the new chapter of smart medical care is reduced to make "small illnesses not leaving townships" a reality. From remote consultation to AI-assisted diagnosis, technological advances are reshaping the medical service model. This article will discuss the results of the 2024 Intel Smart Medical Health Cooperation Forum, showing how intelligent technology can improve medical efficiency and convenience. Song Jiqiang, vice president of Intel Research Institute and dean of Intel China Research Institute of 2024 Intel Intel Intelligent Medical and Health Cooperation Forum, pointed out that strong computing power is the core driving force for the development of the digital economy and is also driving innovation in the medical and health field. Intel is committed to providing high-performance computing to meet the diverse needs of high concurrency, high precision and low latency in the medical field, and build large-scale intelligent medical solutions. Intel Research

Nine Company and brand spokesperson Yi Yang Qianxi have created glory again in the third year of cooperation! The "Battle Pond" Bath Pond Concert, exclusively sponsored by No. 9, has set a new benchmark for brand rejuvenation and industry cross-border cooperation with its unique artistic expression and sincere emotional expression. This concert, which was launched on December 7 and 8, is not only another innovative attempt in cross-border marketing by No. 9, but also a successful example of the deep emotional connection between the brand and young users. The blend of music and life: The unique charm of the bath pool concert. As the exclusive title party of the bath pool concert of "By the Pond", No. 9 has worked hard to create a unique music experience. The concert is divided into two episodes, which will be broadcast on December 7 and 8 respectively. Taking the "bath pool" as a scene with a very lifelike atmosphere

During the trading session of the US stock market, the price of Bitcoin exceeded US$107,000, setting a record high! As of now, the price has fallen slightly, maintaining around US$106,000. Coinglass data shows that in the past 24 hours, the number of people in the cryptocurrency market has reached 113,000, with a total amount of up to US$423 million. Among them, the long positions were liquidated by US$197 million and the short positions were liquidated by US$226 million. Affected by this, cryptocurrency concept stocks have generally risen. RiotPlatforms shares rose more than 8%, Bitdeer Technologies rose more than 10%, Canaan Technology rose more than 8%, and Coinbase shares rose 1.52%.

Xiaomi New Year's Eve Live: Lei Jun revealed that at least 20 world-class factories will be built in the next ten years! During last night's New Year's Eve live broadcast, Xiaomi Chairman Lei Jun summarized the company's brilliant achievements in the past year and announced that in the next ten years, Xiaomi plans to build at least 20 world-class factories! At present, Xiaomi has three advanced production bases: the mobile phone manufacturing center in Changping, Beijing’s modern electric vehicle factory in Yizhuang, and the Wuhan Smart Home Appliances Industrial Park, which will be put into production the year after tomorrow. These factories not only represent the peak of advanced manufacturing technology, but also show Xiaomi's huge contribution to the upgrading of China's manufacturing industry. Faced with Xiaomi's increasingly expanding business territory, Lei Jun emphasized that this is just the beginning. Xiaomi will make every effort to promote its intelligent manufacturing strategy, and in the future, more high-standard factories will be completed and put into production.

On December 25, the highly anticipated "Mo Ran Qiankun" keyboard jointly created by JD.com and "Black Myth: Wukong" IP will be officially launched! The "Mo Ran Qiankun" keyboard is an exclusive cooperation project of Black Myth IP in the keyboard category, and it is also the only keyboard product that has obtained the IP-party game science creative team to fully participate in the appearance design. It is understood that the "Ink-Dyeing the Universe" keyboard is divided into three versions: commemorative version, collector's version and limited collector's version, with prices of 699 yuan, 999 yuan and 1499 yuan respectively. Among them, the limited edition of "Ink Raining the Universe" has only 1,000 units released in the world. In terms of product design, the "Ink-Dyeing Universe" keyboard in JD.com incorporates many traditional cultural elements and game elements of "Black Myth: Wukong". For example, collector's edition and limited edition

Rumors about Nintendo's next-generation Switch game console Switch2 continue to ferment. The recently exposed product pictures of third-party accessories manufacturers reveal some of the appearance details of this new handheld console. For example, the Switch2 translucent protective case picture released by Dbrand hints about its size change. According to Dbrand head Adam Ijaz, the Switch2's size is about 270mm wide, 116mm high, 14mm thick, and the host part is about 200mm wide based on 3D scanning data of real hardware. Compared with SwitchOLED (242mmx102mmx13.9mm), the Switch2's volume has increased significantly. This size change triggers

This article introduces the construction and configuration methods of Nginx. 1. Install Nginx: Use sudoyumininstallnginx on CentOS, use sudoapt-getinstallnginx on Ubuntu, and start with sudosystemctlstartnginx after installation. 2. Basic configuration: Modify the /etc/nginx/nginx.conf file, mainly modify the listen (port) and root (site root directory) instructions in the server block, and after modification, use sudosystemctlrestartnginx to restart and take effect. 3. Virtual host configuration: in nginx.co


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools