Installation of Nginx under Linux

Step 1. Check whether the gcc library is installed
Check the command: rpm -qa|grep gcc*
If the result of the command shows the relevant library of gcc, it means that the relevant library of gcc has been installed. If it is not displayed, then it means that gcc is not installed, then you need to install gcc. The command to install gcc: yum install gcc* -y
If the prompt cannot find the base url of the appropriate yum repository (cannot find a valid baseurl for repo base base), then you need to modify
a file configuration in the /etc/sysconfig/network-scripts/ folder for a long time. Different machines may have different names, but they will start with ifcfg. My machine is ifcfg-enp0s3, and the name of the document I refer to is ifcfg-eth0. But in general, it will contain the following three lines of configuration:

ONBOOT=no
NM_CONTROLLED=no
BOOTPROTO=dhcp

Then we solve the problem of cannot find a valid baseurl for repo base base, just add the following to the file at the beginning of ifcfg

DNS1=8.8.8.8
DNS2=4.2.2.2

To be on the safe side, modify /etc/resolv.conf and add a nameserver 8.8.8.8.

Then restart the network interface, command:
ifdown enp0s3
ifup enp0s3

The second step is to install the pcre
installation command example as follows: yum install pcre*
The third step to install the zlib
installation command example is as follows: yum install zlib zlib-devel
The fourth step If you need to support OpenSSL, the command to install OpenSSL is as follows

    yum install openssl openssl-devel

The fifth step is to download the Nginx source package ( http://nginx.org/ ), and then pressurize it.
Download command wget -c http://nginx.org/download/nginx-1.13.8.tar.gz
Unzip commandtar -xzvf nginx-1.13.8.tar.gz

Step 6 :

./configure --prefix=/usr/common/nginx --withhttp_stub_status_module --with-http_ssl_module

If the prompt is really missing, add the corresponding options. For example, if pcre is missing, add
--with-pcre=/usr/common/temp/pcre-8.34 (of course, we are not missing anything here)
Step 7 :
  After configuration, make and make install in turn

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325724241&siteId=291194637