How to install and configure nginx for LNMP compilation and installation

王林
Release: 2023-05-13 22:22:18
forward
742 people have browsed it

1. Foreword

This installation uses source code installation. The main resource package is downloaded from the official website, and the secondary dependencies are installed using yum. This article only involves the installation of nginx, not The configuration of nginx and how nginx accesses php are not covered in this article.

2. Installation steps

nginx

2.1. Download nginx

wget http://nginx.org/download/nginx-1.12.0.tar.gz
Copy after login

How to install and configure nginx for LNMP compilation and installation

##2.2 , Download the pcre installation package

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
Copy after login

How to install and configure nginx for LNMP compilation and installation

This package does not need to be installed, it is just a medium

2.3. Unzip nginx and pcre

tar zxvf nginx-1.12.0.tar.gz
Copy after login

How to install and configure nginx for LNMP compilation and installation

tar zxvf pcre-8.39.tar.gz
Copy after login

How to install and configure nginx for LNMP compilation and installation

2.4. Install dependency packages

yum install -y gcc gcc-c++ zlib-devel
Copy after login

How to install and configure nginx for LNMP compilation and installation

2.5. Generate makefile

cd nginx-1.12.0
Copy after login

How to install and configure nginx for LNMP compilation and installation

./configure --prefix=/usr/local/nginx (installation directory) --with-pcre=../pcre-8.39/(pcre relative directory)

How to install and configure nginx for LNMP compilation and installation

The results are as follows:

How to install and configure nginx for LNMP compilation and installation

2.6. Compile and install

make && make install
Copy after login

How to install and configure nginx for LNMP compilation and installation

The results are as follows :

How to install and configure nginx for LNMP compilation and installation

The nginx installation is completed here

3. Start nginx

/usr/local/ nginx/sbin/nginx

Check the running status through ps aux|grep nginx

How to install and configure nginx for LNMP compilation and installation

At this point nginx will start normally.

4. Open port 80 for external access

If you only run it without opening the port, the browser will not be able to access it.

firewall-cmd --zone=public --add-port=80/tcp --permanent
Copy after login

How to install and configure nginx for LNMP compilation and installation

Successfully opened port 80

You need to restart the firewall to open the play port

systemctl restart firewalld.service
Copy after login

How to install and configure nginx for LNMP compilation and installation

Go here , you can re-open the browser and access

How to install and configure nginx for LNMP compilation and installation

Access the browser, and the above interface appears, which means that nginx has been installed.

The above is the detailed content of How to install and configure nginx for LNMP compilation and installation. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template