Perform the Nginx installation tutorial on CentOS 7
- 2020-05-12 06:58:29
- OfStack
1. Installation preparation
First of all, since some modules of nginx depend on some lib libraries, these lib libraries must be installed before installing nginx. These dependent libraries mainly include g++, gcc, openssl-devel, pcre-devel and zlib-devel
yum install gcc-c++
yum install pcre pcre-devel
yum install zlib zlib-devel
yum install openssl openssl--devel
2. Install Nginx
Before installation, it is best to check whether nginx has been installed
find -name nginx
If the system already has nginx installed, uninstall it first
yum remove nginx
First go to the /usr/local directory
cd /usr/local
Download the latest version of nginx from the official website
wget http://nginx.org/download/nginx-1.9.6.tar.gz
tar -zxvf nginx-1.9.6.tar.gz
cd nginx-1.9.6
To install, use the --prefix parameter to specify the directory for the nginx installation,make, make install installation
./configure $ The default installation is /usr/local/nginx
make
make install
If there are no errors reported, it is best to look at the nginx installation directory once it is completed
whereis nginx
Once installed, you can start or stop it by entering the post-installation directory (/usr/local/nginx)