W3Schools Learner's Blog

w3Schools programming knowledge summary website

div

5/21/2018

yum install nginx server on centos 7

How to install nginx server on centos 7 with the yum command? Let's try it together!

About Nginx

Nginx is a high performance web server software. It is a much more flexible and lightweight program than Apache HTTP Server.
This tutorial will teach you how to install and start Nginx on your CentOS 7 server.

Step One—Add Nginx Repository

To add the CentOS 7 EPEL repository, open xshell and use the following command:
  1. sudo yum install epel-release

Step Two—Yum Install Nginx

Now that the Nginx repository is installed on your server, install Nginx using the following yum command:
  1. sudo yum install nginx
After you answer yes to the prompt, Nginx will finish installing on your virtual private server (VPS).

Step Three—Start Nginx Server

Nginx will not start automatically after it is installed, so you need to use the systemctl command of Centos 7 to start the nginx server. 
  1. sudo systemctl start nginx
If you are running a firewall, run the following commands to allow HTTP and HTTPS traffic:
  1. sudo firewall-cmd --permanent --zone=public --add-service=http 
  2. sudo firewall-cmd --permanent --zone=public --add-service=https
  3. //reload firewall
  4. sudo firewall-cmd --reload
After starting nginx, we can enter a common IP or domain name in the browser to access the home page of the nginx, and if you can successfully access it, we can prove that the nginx installation is successful.

http://server_domain_name_or_IP/

As follows:








Before continuing, you will probably want to enable Nginx to start when your system , enter the following command:
  1. sudo systemctl enable nginx
thanks!

No comments:

Post a Comment

Note: only a member of this blog may post a comment.