Install NginX CentOS 7

Add Nginx Repository

To add the CentOS 7 EPEL repository, open terminal and use the following command:

sudo yum install epel-release

Install Nginx

Now that the Nginx repository is installed on your server, install Nginx using the following yum command:

sudo yum install nginx -y

Start Nginx

Nginx does not start on its own. To get Nginx running, type:

sudo systemctl start nginx

If you are running a firewall, run the following commands to allow HTTP and HTTPS traffic:

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

You can do a spot check right away to verify that everything went as planned by visiting your server’s public IP address in your web browser (see the note under the next heading to find out what your public IP address is if you do not have this information already):

http://server_domain_name_or_IP/

Before continuing, you will probably want to enable Nginx to start when your system boots. To do so, enter the following command:

sudo systemctl enable nginx

Leave a Reply

Your email address will not be published. Required fields are marked *