Home  >  Article  >  Operation and Maintenance  >  How to use Centos7.3 to install and deploy Nginx and configure https

How to use Centos7.3 to install and deploy Nginx and configure https

WBOY
WBOYforward
2023-05-24 08:37:121025browse

Installation environment

1. gcc installation

You need to install nginx first Compile the source code downloaded from the official website

Compilation depends on gcc environment:

yum install gcc-c++

2. pcre pcre-devel installation

Install pcre-devel It is a secondary development library developed using pcre. :

yum install -y pcre pcre-devel

3. zlib installation

The zlib library provides many compression and decompression methods. 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, commonly used keys and certificates Encapsulation management functions and ssl protocol. Need nginx to support https (transmit http over ssl protocol)

yum install -y openssl openssl-devel

Install nginx

Use wget command to download

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

Unzip

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

Configuration

Normal configuration

#./configure

Configuration https:

./configure --with-http_ssl_module

Installation

make
make install

Find the installation path:

whereis nginx

Start and stop nginx

cd /usr/local/nginx/sbin/
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload

Comments:

./nginx -t: View nginx.conf configuration Is the file correct?

./nginx -s quit: The stop step in this method is to stop the nginx process after the task is completed.

./nginx -s stop: This method is equivalent to first finding out the nginx process ID and then using the kill command to forcefully kill the process.

To configure SSL, please check which server you are using. Apply for an SSL certificate when applying for a domain name, and then configure it directly in the server load balancing.

The above is the detailed content of How to use Centos7.3 to install and deploy Nginx and configure https. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete