Complete the installation of Nginx under Linux

Install Nginx

Step 1: Mount the CD-ROM to the media directory

Reason: Because the path is long, the CD-ROM drive is mounted to the media directory through the mount command to access the device.

[root@server1 ~]# mount /dev/cdrom/ /media/

Step 2: Download nginx

download link

Step 3: Download to the src directory

[root@server1 src]# wget http://nginx.org/download/nginx-1.16.1.tar.gz

Insert picture description here

Step 4: Unzip

[root@server1 src]# tar zxf nginx-1.16.1.tar.gz

Problem: The source code cannot be installed by executing the yum install command like the rpm package.
Solution: Check the environment and install it without entering Yes or No

[root@server1 nginx-1.16.1]# ./configure
[root@server1 nginx-1.16.1]# yum install -y gcc

If you execute yum install -y gcc and the following problems occur,
Insert picture description here
check the warehouse yum repolist and findyum source is not configured
Insert picture description here

Step 5: Check the environment

Check the environment again and find that pcre is not installed and execute the command:
Insert picture description here

[root@server1 nginx-1.16.1]# yum install -y pcre-devel

Then check the environment and find that zlib is not installed and execute the command:
Insert picture description here

[root@server1 nginx-1.16.1]# yum install -y zlib-devel

The final result of checking the environment is successful!

Insert picture description here

Put ngix in the local directory

[root@localhost nginx-1.16.1]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module

Step 6: Start nginx

Compile the source code:

[root@localhost nginx-1.16.1]# make
[root@localhost nginx-1.16.1]# make install

Run the script:
Insert picture description here
access the configured ip address from the browser:
Insert picture description here

Guess you like

Origin blog.csdn.net/lirui1212/article/details/105458938