How to install Nginx on CentOS 8

Nginx pronounced "engine x", it is an open source, high-performance HTTP and reverse proxy server, used to handle the load of some large websites on the Internet. It can be used as an independent web server, [load balancing] (https://cloud.tencent.com/product/clb?from=10680), content caching, and reverse proxy server for HTTP and non-HTTP.

Compared with Apache, Nginx can handle more parallel connections, and each connection takes up less memory.

This guide explains how to install and manage Nginx on CentOS 8.

1. Prerequisites##

Before proceeding, please make sure that you are logged into the system as a user with sudo privileges, and that you have not installed Apache and no processes occupy ports 80 and 443.

2. Install Nginx on CentOS 8

On CentOS 8, the Nginx package is available in the default CentOS software source repository.

Installing Nginx on CentOS 8 is very simple, enter:

sudo yum install nginx

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

sudo systemctl enable nginx
sudo systemctl start nginx

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

sudo systemctl status nginx

The output looks like this:

● nginx.service - The nginx HTTP and reverse proxy server
 Loaded:loaded(/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
 Active:active(running) since Sun 2019-10-0618:35:55 UTC; 17min ago
   ...

Three, adjust firewall##

FirewallD is the default firewall solution on CentOS 8.

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

Use the following command to open the necessary ports:

sudo firewall-cmd --permanent --zone=public--add-service=http
sudo firewall-cmd --permanent --zone=public--add-service=https
sudo firewall-cmd --reload

Now, you can test whether the Nginx installation was successful. Enter http://YOUR_IP in your browser and open it. You should see the default welcome page of Nginx, like the following:

Four, Nginx configuration file structure and best practices##

Five, summary##

Congratulations, you have successfully installed Nginx on CentOS 8. You are now ready to deploy the application. You can use Nginx as a web server or a proxy server.

Recommended Posts

How to install Nginx on CentOS 8
How to install jdk1.8 on centOS7
How to install MySQL on CentOS 8
How to install Memcached on CentOS 8
How to install R on CentOS 8
How to install FFmpeg on CentOS 8
How to install Virtualbox on CentOS 8
How to install Nginx on Ubuntu 20.04
How to install TensorFlow on CentOS 8
How to install TeamViewer on CentOS 8
How to install Perl 5 on CentOS
How to install Git on CentOS 8
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Jenkins on CentOS 8
How to install Java on CentOS 8
How to install Go on CentOS 8
How to install GCC on CentOS 8
How to install Yarn on CentOS 8
How to install Asterisk on CentOS 7
How to install Jenkins on CentOS 8
How to install Vagrant on CentOS 8
How to install Python 3.8 on CentOS 8
How to install Tomcat 9 on CentOS 8
How to install Webmin on CentOS 8
How to install Ruby on CentOS 8
How to install Skype on CentOS 8
How to install htop on CentOS 8
How to install Python on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Postgresql on CentOS 8
How to install Wordpress on Centos
How to install Nginx on Ubuntu 20.04
How to install htop on CentOS 8
How to install TeamViewer on CentOS 8
How to install MariaDB on CentOS 8
How to install Nginx on Ubuntu 16.04
How to install MongoDB on CentOS 7
How to install Odoo 13 on CentOS 8
How to install Apache on CentOS 8
How to install OpenCV on CentOS 8
How to install PHP on CentOS 8
How to install MongoDB on CentOS 8
How to install Apache Maven on CentOS 8
How to install Apache Kafka on CentOS 7
[Graphic] How to install tomcat on centos
R&D: How To Install Python 3 on CentOS 7
How to install GCC compiler on CentOS 7
How to install offline JDK1.8 on centos7.0
Install Nginx server on CentOS 7
How to install Visual Studio Code on CentOS 8
How to install and use Docker on CentOS 7
How to install RPM packages on CentOS Linux
How to install and configure VNC on CentOS 8
How to install and use Composer on CentOS 8
How to install and configure Redis on CentOS 8
How to install Node.js and npm on CentOS 8
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
How to install and configure phpMyAdmin on CentOS 6
How to install and use Curl on CentOS 8
How to install and configure Owncloud on CentOS 8