Home > Operation and Maintenance > Nginx > 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
Release: 2023-05-24 08:37:12
forward
1035 people have browsed it

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++
Copy after login

2. pcre pcre-devel installation

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

yum install -y pcre pcre-devel
Copy after login

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
Copy after login

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
Copy after login

Install nginx

Use wget command to download

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

Unzip

tar -zxvf nginx-1.9.9.tar.gz
cd nginx-1.9.9/
Copy after login

Configuration

Normal configuration

#./configure
Copy after login

Configuration https:

./configure --with-http_ssl_module
Copy after login

Installation

make
make install
Copy after login

Find the installation path:

whereis nginx
Copy after login

Start and stop nginx

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

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template