This category has an environment one-click installation. What's going on behind this? Let's use the source code to install it manually.
1. First of all, there is a centos that can be networked.
2. Baidu NINGX Official network download http://nginx.org/en/download.html find the latest version of Nginx. When posting the latest is 1.12 http://nginx.org/download/nginx-1.12.0.tar.gz
3. Execute the CentOS command
#安装wget
yum
install
wget -y
#安装gcc和c++编译器
yum
install
gcc gcc-c++ -y
Error tip:./configure:error:the HTTP Rewrite module requires the PCRE library. Install Pcre-devel and openssl-devel solve the problem yum-y install Pcre-devel OpenSSL openssl-devel./configure--prefix=/usr/local/ Nginxmakemake Install 4. Create a new temp directory/temp then download and unzip it. The command is as follows
mkdir
/temp
;
cd
/temp
;
wget http:
//nginx
.org
/download/nginx-1
.12.0.
tar
.gz
tar
zxvf .
/nginx-1
.12.0.
tar
.gz
cd
/temp/nginx-1
.12.0
Get path: [[email protected] nginx-1.12.0]# pwd
/temp/nginx-1.12.0
[email protected] nginx-1.12.0]# LL
Total 724
Drwxr-xr-x. 6 1001 1001 4096 APR 11:42 Auto
-rw-r--r--. 1 1001 1001 277049 APR 22:46 Changes
-rw-r--r--. 1 1001 1001 421985 APR 22:46 changes.ru
Drwxr-xr-x. 2 1001 1001 4096 APR 11:42 conf
-rwxr-xr-x. 1 1001 1001 2481 APR 22:46 Configure
Drwxr-xr-x. 4 1001 1001 4096 APR 11:42 Contrib
Drwxr-xr-x. 2 1001 1001 4096 APR 11:42 html
-rw-r--r--. 1 1001 1001 1397 APR 22:46 LICENSE
Drwxr-xr-x. 2 1001 1001 4096 APR 11:42 man
-rw-r--r--. 1 1001 1001 APR 22:46 README
Drwxr-xr-x. 9 1001 1001 4096 APR 11:42 src 5.linux Three installation steps configuration, compile, install first step, configure
--prefix=/Post-Installation path Note this is basically a common configuration property for all setup programs
Input command
.
/configure
--prefix=
/usr/local/nginx-mytest
Next error will be as follows
./configure:error:the HTTP Rewrite module requires the PCRE library.
You can either disable the module by using--without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
Statically from the source with Nginx by using--with-pcre=<path> option.
We need to install an environment that is able to continue. According to the above meaning. Let's first install the pcre and specify the path specified by the--with-pcre=<path>.
6. Install Pcre. The word Baidu is on the official website. Then find the download path as follows
Ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/There are some listings here. We'll find the newest. is currently
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz download, unzip, compile
mkdir
/temp
;
cd
/temp
;
wget
ftp
:
//ftp
.csx.cam.ac.uk
/pub/software/programming/pcre/pcre-8
.39.
tar
.gz
tar
zxvf pcre-8.39.
tar
.gz
To this get the Pcre source path for/temp/pcre-8.39
7. Previous step to get the installation path/usr/local/pcre-8.39 next we're going to start with the new nginx. Don't forget--with-pcre=<path>.
cd
/temp/nginx-1
.12.0
.
/configure
--prefix=
/usr/local/nginx-mytest
--with-pcre=
/temp/pcre-8
.39
Discovery Complete
The second command is make, which is compiled, and can be executed in conjunction with the third step, and the third step is install. So we got orders.
make
&&
make
install
Let's go to/usr/local/nginx-mytest. The installation was successful.
Linux installation Nginx yum