Detailed tutorial for installing nginx on centos8 (picture and text)

Detailed tutorial for installing nginx on centos8 (picture and text)

Nginx, pronounced "engine x," 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.

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

This tutorial explains how to install Nginx on CentOS 8.

NGINX official website

http://nginx.org/

Create folder mkdir nginx
Enter the created folder and download the appropriate version according to your needs

Download the file via wget http://nginx.org/download/nginx-1.17.6.tar.gz

Install necessary plugins

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

Let me talk about the role of these

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. The http module of nginx uses pcre to parse regular expressions, so you need to install the pcre library

zlib zlib-devel The zlib library provides many compression and decompression methods. Nginx uses zlib to gzip the contents of the http package, so it needs to be installed

openssl openssl-devel Openssl is the cornerstone of web secure communication. Without openssl, it can be said that our information is running naked

Unzip the downloaded file
tar -zxvf nginx-1.17.6.tar.gz
Enter the nginx-1.17.6 folder and start installing the specified installation path
./configure --prefix=/software/nginx
This sentence means to specify the installation path
--prefix=/software/nginx
Compile
make
Install
make install
Enter the sbin directory under the nginx installation directory
Startup Command
./nginx

Open the browser and access your IP address. If this page is displayed, it means that nginx has been successfully started.

Stop services gracefully

This method is milder than stop, and requires the process to complete the current work before stopping.
nginx -s quit

Stop service immediately

This method is more aggressive and stops the process directly regardless of whether it is working or not.
nginx -s stop

Query the nginx main process number

ps -ef | grep nginx

Stop calmlykill -QUIT The main process number stops quicklykill -TERM The main process number stops forciblykill -9 nginx

ps: Install Nginx on CentOS 8

Starting from CentOS 8, Nginx packages are available in the default CentOS repositories.

Installing Nginx on CentOS 8 is as simple as typing:

Once the installation is complete, enable and start the Nginx service with the following commands:

To verify that the service is running, check its status:

The output should look like this:

Adjust the firewall

FirewallD is the default firewall solution on CentOS 8.

During the installation, Nginx creates a firewall service file with predefined rules to allow access to HTTP (80) and HTTPS (443) ports.

Open the necessary ports permanently using the following command:

Now you can test your Nginx installation by opening http://YOUR_IP in your web browser. You should see the default Nginx welcome page, which should look similar to the image below:

Summarize

The above is a detailed tutorial (with pictures and text) on how to install nginx on centos8 introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • How to install PHP7.4 and Nginx on Centos
  • Solve the problem of "Welcome to nginx on Fedora!" after installing nginx on Centos7, and there is no default.conf file in the conf.d directory
  • How to install Nginx in CentOS7 and configure automatic startup
  • Detailed tutorial on installing PHP and Nginx on Centos7
  • Detailed explanation of Centos7 source code compilation and installation of Nginx1.13
  • Detailed process of installing nginx1.9.1 on centos8

<<:  Example of how to implement MySQL cascading replication

>>:  Record the steps of using mqtt server to realize instant communication in vue

Recommend

Linux uses bond to implement dual network cards to bind a single IP sample code

In order to provide high availability of the netw...

Mysql command line mode access operation mysql database operation

Usage Environment In cmd mode, enter mysql --vers...

Problem analysis of using idea to build springboot initializer server

Problem Description Recently, when I was building...

A method of hiding processes under Linux and the pitfalls encountered

Preface 1. The tools used in this article can be ...

Implementation of LNMP for separate deployment of Docker containers

1. Environmental Preparation The IP address of ea...

Analyze how uniapp dynamically obtains the interface domain name

background The interface domain name is not hard-...

...

Vue implements left and right sliding effect example code

Preface The effect problems used in personal actu...

How to correctly modify the ROOT password in MySql8.0 and above versions

Deployment environment: Installation version red ...

MySQL data loss troubleshooting case

Table of contents Preface On-site investigation C...

How to get the current time using time(NULL) function and localtime() in Linux

time(); function Function prototype: time_t time(...

Implementation of installing and uninstalling CUDA and CUDNN in Ubuntu

Table of contents Preface Install the graphics dr...

Details of MutationObServer monitoring DOM elements in JavaScript

1. Basic Use It can be instantiated through the M...

Web lesson plans, lesson plans for beginners

Teaching Topics Web page Applicable grade Second ...

Solution to the problem of invalid line-height setting in CSS

About the invalid line-height setting in CSS Let&...