Centos custom offline installation of Nginx

1. Introduction

Nginx is a web server that can also be used for load balancing and reverse proxy.

Currently, the most used one is load balancing. This article mainly introduces the installation of nginx on centos8.

Nginx is an open-source, high-performance HTTP and reverse proxy server responsible for handling the load of some of the largest sites on the Internet.

It can be used as a standalone web server, load balancer, content cache and reverse proxy for HTTP and non-HTTP servers.

Compared to Apache, Nginx can handle a large number of concurrent connections and has a smaller memory footprint per connection.

2. Download Nginx

1. Download

Download the installation package from the official website

2. Create a folder
mkdir nginx
3. Enter the created folder and download the appropriate version as needed.

3. Install the necessary plug-ins

yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel make

The role of these plugins:

gcc can compile languages ​​such as C, C++, Ada, Object C and Java

pcre pcre-devel pcre is a perl library, including a perl-compatible regular expression library, nginx's http module uses pcre to parse regular expressions, so you need to install the pcre library

zlib zlib-devel The zlib library provides a variety of compression and decompression methods nginx uses zlib to gzip the content of the http package, so it needs to be installed

openssl openssl-devel openssl is the cornerstone of web security communication, without openssl, it can be said that our information is streaking

4. Unzip the downloaded file

tar -zxvf nginx-1.20.1.tar.gz
1. Go to nginx-1.20.1the folder below.
cd nginx-1.20.1
2. Specify the installation path
# 这句话的意思是指定安装路径

./configure --prefix=/root/运行环境/Nginx
3. Compile and install
make && make install
4. Configure the firewall
#开启nginx的端口权限
firewall-cmd --zone=public --add-port=80/tcp --permanent

#防火墙重新加载配置
firewall-cmd --reload
5. Go to the sbin under the nginx directory
cd /root/运行环境/Nginx/sbin
6. Start command
./nginx

Open the browser and enter the IP address. If this page is displayed, it means that Nginx has started successfully.

Guess you like

Origin blog.csdn.net/weixin_44778232/article/details/127597974