centos7 compiles the method steps for installing nginx

  • 2020-05-15 03:32:01
  • OfStack

Install the lib libraries required for nginx compilation


yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
yum -y install pcre pcre-devel

View the pcre(regular library) version


pcre-config --version

Go to the compiled directory


cd /usr/local/src

Download the latest nginx(stable version stable) from the website


wget http://nginx.org/download/nginx-1.14.0.tar.gz

Extract the nginx package


tar -zxvf nginx-1.14.0.tar.gz

Enter the unzip directory


cd nginx-1.14.0

Run the configuration script (--prefix parameter specifies the directory of the nginx installation, which is installed at /usr/local/nginx by default)


./configure --prefix=/usr/local/nginx

Compile and install nginx


make && make install

Soft link nginx execution command to /usr/bin


ln -s /usr/local/nginx/sbin/nginx /usr/bin

Start the nginx


nginx

Set the boot to start


pcre-config --version
0

And that's the whole installation process...

perform nginx -h View related commands


pcre-config --version
1

See the nginx installation directory


pcre-config --version
2

Related articles: