Environment information: Tencent cloud server SUSE Linux

1. Download the installation package

The installation package is small and can be downloaded from the official website: nginx.org/en/download…

Select stable download

2. Upload the file to the Linux server and decompress it

Unpack the command

The tar - ZXVF nginx - 1.20.0. Tar. GzCopy the code

Install the Nginx dependent build environment

#I'm running SUSE, so use Zypper, redhat can use yum
zypper install -y gcc-c++ zlib zlib-devel pcre-devel openssl openssl-devel
Copy the code

Compile Nginx

#Go to the decompressed nginx directory and run the following commands in sequence
./configure
make
make install
Copy the code

Set up soft links to facilitate global use of nginx directives

#Create soft links with the source file in front (your own nginx directory instead) and the target file in the back
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
Copy the code

Start nginx and check

#Start the
nginx
Copy the code

Type IP :port in the browser to test whether nginx can access: