linfandeMacBook-Air:Desktop linfan$ scp nginx-1.12.2.tar.gz [email protected]:/root/The authenticity of host ‘192.168.24.232 (192.168.24.232)‘ can‘t be established.ECDSA key fingerprint is SHA256:wP6N3stFy7MIxVcNOHgsB+ss19sxVcItL61X/YcY/kM.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added ‘192.168.24.232‘ (ECDSA) to the list of known hosts.[email protected]‘s password: nginx-1.12.2.tar.gz 100% 959KB 958.7KB/s 00:00
Open the Mac terminal and enter the above command to upload the Nginx package to the Linux virtual machine
[[email protected] ~]# lsanaconda-ks.cfg nginx-1.12.2.tar.gz //查看是否上传成功[[email protected] ~]# tar xf nginx-1.12.2.tar.gz // 解压nginx包[[email protected] ~]# lsanaconda-ks.cfg nginx-1.12.2 nginx-1.12.2.tar.gz[[email protected] ~]# cd nginx-1.12.2
[[email protected] nginx-1.12.2]#./configure--prefix=/opt/nginx-1.12.2//Specify compilation parameters
checking for OS......../configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_moduleoption, or install the PCRE library into the system, or build the PCRE librarystatically from the source with nginx by using --with-pcre=<path> option
Error is prompted to install the source
[email protected] nginx-1.12.2]# Yum install-y pcre-devel
[email protected] nginx-1.12.2]# Yum install-y zlib-devel
[[email protected] nginx-1.12.2]#./configure--prefix=/opt/nginx-1.12.2 Execute the specified compilation parameters command again
[[email protected] nginx-1.12.2]# echo $?
0
Check if this step is wrong, not 0 is the last command error
[[email protected] nginx-1.12.2]# make//compile
[[email protected] nginx-1.12.2]# make install//install
[[email protected] nginx-1.12.2]#/opt/nginx-1.12.2/sbin/nginx//Start Nginx Service
[[email protected] nginx-1.12.2]# echo $?
0
Check if this step is wrong, not 0 is the last command error
[[email protected] nginx-1.12.2]# ps-ef|grep nginx//See if Nginx process exists
root 20397 1 0 19:36 ? 00:00:00 nginx: master process /opt/nginx-1.12.2/sbin/nginxnobody 20398 20397 0 19:36 ? 00:00:00 nginx: worker processroot 20400 2183 0 19:37 pts/1 00:00:00 grep --color=auto nginx
[[email protected] nginx-1.12.2]# Ss-natl//See if Nginx port number exists
State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:80 *:* LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 128 :::22 :::* LISTEN 0 100 ::1:25 :::*
Installation brief of the Linux compiler Nginx