Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to quickly install Nginx in CentOS7

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article focuses on "how to quickly install Nginx in CentOS7". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to quickly install Nginx in CentOS7.

Catalogue

1. Overview

2. Download the Nginx installation package

3. Install the dependency package

4. Copy the Nginx installation package to the CentOS7 system and extract it

6. Compile and install

7. Start Nginx

8. Common commands of Nginx

1. Overview

Nginx is an indispensable tool when we develop Java projects. Most of the time, it is used for reverse proxy back-end servers to achieve load balancing and solve high concurrency.

Most of the time, the installation and configuration of Nginx is done by operation and maintenance personnel, but in some companies that do not have operation and maintenance positions, developers are still needed to do this work.

Today we just want to explain how to quickly install Nginx under CentOS7 system.

2. Download the Nginx installation package

1) go to the Nginx website (https://nginx.org/) and click the download link

Screenshots come from the official website

2) in Stable version, download the latest version

Screenshots come from the official website

3. Install the dependency package

In CentOS7 command line mode, enter the following commands to install the required dependency packages

Yum install-y gcc-c++

Yum install-y pcre pcre-devel

Yum install-y zlib zlib-devel

Yum install-y openssl openssl-devel

4. Copy the Nginx installation package to the CentOS7 system and extract it

There are many ways to copy the installation package to the CentOS7 system. You can use the Xshell tool to connect to the CentOS7 system and use the rz command to upload, or you can use Xftp or other tools to upload.

Here we put the Nginx installation package in the / home directory.

Enter the / home directory

Enter the tar-zxvf nginx-1.20.1.tar.gz command to extract the installation package

5. Configure Nginx

Enter the decompressed Nginx folder, # cd nginx-1.20.1

Enter the configuration command:

. / configure

-prefix=/usr/local/nginx

-pid-path=/var/local/nginx/nginx.pid

-lock-path=/var/local/nginx/nginx.lock

-error-log-path=/var/local/nginx/error.log

-http-log-path=/var/local/nginx/access.log

-with-http_gzip_static_module

-http-client-body-temp-path=/var/local/nginx/client

-http-proxy-temp-path=/var/local/nginx/proxy

-http-fastcgi-temp-path=/var/local/nginx/fastcgi

-http-uwsgi-temp-path=/var/local/nginx/uwsgi

-http-scgi-temp-path=/var/local/nginx/scgi

6. Compile and install

Compile, enter the command: # make

After installation and compilation, enter the command: # make install

7. Start Nginx

Go to the Nginx directory: # cd / usr/local/nginx/sbin

Enter the startup command: #. / nginx

At this point, use the browser to access the IP address of the CentOS7 server, and you can see the home page of the Nginx.

8. Common commands of Nginx

Nginx's forced stop command: #. / nginx-s stop

Nginx's graceful stop command: #. / nginx-s quit / / graceful stop, wait until the last interaction is finished.

Nginx checks the configuration file for errors: #. / nginx-t

Reload command for Nginx: #. / nginx-s reload

Check the Nginx version: #. / nginx-v

View the detailed version of Nginx: #. / nginx-V

At this point, I believe you have a deeper understanding of "how to quickly install Nginx in CentOS7". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report