How to Install Nginx on CentOS 7

Содержание

NGINX (short for Engine X) is a free, open-source and powerful HTTP web server and reverse proxy with an event-driven (asynchronous) architecture. It is written using C programming language and runs on Unix-like operating systems as well as Windows OS.

It also works as a reverse proxy, standard mail and TCP/UDP proxy server, and can additionally be configured as a load balancer. It is powering many sites on the web; well known for its high-performance, stability and feature-rich set.

In this article, we will explain how to install, configure and manage Nginx HTTP web server on a CentOS 7 or RHEL 7 server using command line.

Prerequisites:

Install Nginx Web Server

1. First update the system software packages to the latest version.

2. Next, install Nginx HTTP server from the EPEL repository using the YUM package manager as follows.

Install Nginx on CentOS 7

Manage Nginx HTTP Server on CentOS 7

3. Once Nginx web server installed, you can start it first time and enable it to start automatically at system boot.

Start and Enable Nginx at Boot

Configure firewalld to Allow Nginx Traffic

4. By default, CentOS 7 built-in firewall is set to block Nginx traffic. To allow web traffic on Nginx, update the system firewall rules to permit inbound packets on HTTP and HTTPS using the commands below.

Allow Nginx on Firewalld

Test Nginx Server on CentOS 7

5. Now you can verify Nginx server by going to the following URL, a default nginx page will be shown.

Test Nginx Installation

Nginx Important Files and Directories

  • The default server root directory (top level directory containing configuration files): /etc/nginx.
  • The main Nginx configuration file: /etc/nginx/nginx.conf.
  • Server block (virtual hosts) configurations can be added in: /etc/nginx/conf.d.
  • The default server document root directory (contains web files): /usr/share/nginx/html.

You may also like to read these following Nginx web server related articles.

In this article, we showed how to install and manage Nginx HTTP server from the command line on CentOS 7. You can ask questions or give us any feedback via the comment form below.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Install LEMP on Rocky Linux

Install Varnish Cache for Nginx on CentOS 7

Improve PHP-FPM Performance

Apache Log Monitoring Tool

Install and Run Applications in Docker Containers

Create Nginx Server Blocks in CentOS

Got something to say? Join the discussion. Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Источник: www.tecmint.com