CentOS 7.2 64-bit Nginx

Modify the hostname, permanently:

hostnamectl set-hostname hostname

 

Nginx installation:

1. Installation preparation

First of all, because 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, so execute the following command to install

 

yum install gcc-c++  

yum install pcre pcre-devel  

yum install zlib zlib-devel  

yum install openssl openssl--devel

 

2. Install Nginx

Before installing, it is best to check if nginx is already installed

find -name nginx

If the system has already installed nginx, then 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.11.5.tar.gz

tar -zxvf nginx-1.11.5.tar.gz

cd nginx-1.11.5

Next install, use the --prefix parameter to specify the directory where nginx is installed, make, make install install

./configure   -- with - http_ssl_module $ default installed in /usr/local/nginx configure ssl https

make  

make install

If there is no error, after the successful completion, it is best to look at the installation directory of nginx

whereis nginx

After the installation is complete, enter the post-installation directory (/usr/local/nginx) to start or stop it

start nginx

cd /usr/local/nginx/sbin

./nginx

 

Check the port status

netstat -nupl (UDP type port)

netstat -ntpl (TCP type port)

Guess you like

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