Centos7.3 method steps for installing and deploying Nginx and configuring https

  • 2020-05-17 07:36:48
  • OfStack

Installation environment

1. gcc installation

To install nginx, you need to compile the source code downloaded from the official website

Compile dependent gcc environment:


yum install gcc-c++

2. Installation of PCRE pcre-devel

Installing pcre-devel is a two-time development library developed using pcre. :


yum install -y pcre pcre-devel

3. zlib installation

The zlib library provides a number of ways to compress and uncompress, and nginx can use zlib to gzip the contents of the http package:


yum install -y zlib zlib-devel

4. OpenSSL installation

A powerful secure socket layer cryptographic library with major cryptographic algorithms, common key and certificate encapsulation management functions, and the SSL protocol. nginx is required to support https (transport http over ssl protocol)


yum install -y openssl openssl-devel

Install Nginx

Download using the wget command


wget -c https://nginx.org/download/nginx-1.9.9.tar.gz

Unpack the


tar -zxvf nginx-1.9.9.tar.gz
cd nginx-1.9.9/

configuration

Common configuration


#./configure

Configuration https:


./configure --with-http_ssl_module

The installation


make
make install

Find the installation path:


whereis nginx

Start and stop nginx


yum install -y pcre pcre-devel
0

Note:

./ nginx-t: check the nginx.conf configuration file to see if it is correct

./ nginx-s quit: the stop step in this manner is to stop the nginx process when the processing task is completed.

./ nginx-s stop: this is equivalent to checking out nginx id and then using kill to force the process to be killed.

To configure ssl, please check which server you are using. Apply for the ssl certificate at the same time as applying for the domain name.


Related articles: