1. Install the GCC -c++ compiler

yum install gcc-c++
yum install -y openssl openssl-devel
Copy the code

2. Install pcRE packages

yum install -y pcre pcre-devel
Copy the code

3. Install zlib

yum install -y zlib zlib-devel
Copy the code

4. Create the nginx folder

mkdir /usr/local/nginx
Copy the code

5. Go to the folder to download nginx

Wget HTTP: / / https://nginx.org/download/nginx-1.19.9.tar.gzCopy the code

You can also download it to a local PC (nginx.org/download) and upload it to the server

6. Decompress and go to the nginx directory

Tar -zxvf nginx-1.19.9.tar.gz CD nginx-1.19.9Copy the code

7. Use the default nginx configuration

./configure
Copy the code

8. Compile and install

make && make install
Copy the code

9. Locate the installation path and check whether the installation is successful

whereis nginx
Copy the code

10. Go to the sbin directory under the installation directory. You can see that there is an executable file nginx and start the service

./nginx
Copy the code

11. Check whether the startup is successful

ps -ef | grep nginx
Copy the code

12. Access your IP address on the web page. The default port is 80