How to install Nginx in CentOS 7
Nginx is a web server like Apache. I will not go to which is better and why one should use it. Google is your friend to find that out. Here we will focus on how to install latest stable version of Nginx in CentOS 7. Login to your server.
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
Above command will setup the repository.
Update the system:
sudo yum update
Install Nginx:
sudo yum install nginx
Start Nginx:
sudo systemctl start nginx
Enable it at boot time:
sudo systemctl enable nginx
Nginx basic configuration is located in /etc/nginx/ as nginx.conf. For virtual hosts there is directory conf.d in /etc/nginx which can be used to create multiple configuration files inside for different hosts like server1.conf, server2.conf etc.