Nginx Installation on CentOS


NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption



Steps to install Nginx on CentOS 7 through YUM:-

1. Add nginx reposiotry
yum install epel-release

2. Install nginx package
yum install nginx -y

3. Start the service
systemctl start nginx
systemctl enable nginx
systemctl status nginx

Note: If already apache service is running means, Stop the http service and start the nginx service
                systemctl stop httpd
                systemctl disable httpd
                systemctl status httpd

4. Enable https service in firewall
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

5. Check nginx using URL
http://10.11.12.145/ -> If you going to use on another machine
                      or
                http://localhost -> If your using only within a system

6. Install mariadb:-
yum install mariadb-server mariadb
systemctl start mariadb
mysql_secure_installation

7. Install PHP:
yum install php php-mysql php-fpm

8. Config PHP
mkdir -p /var/www/ramprasath.com/
chmod 755 /var/www
vim /var/www/ramprasath.com/index.html

vim /etc/nginx/conf.d/virtual.conf
systemctl restart nginx.service


Note:
The default server root directory is /usr/share/nginx/html.
The default server config file /etc/nginx/conf.d/default.conf.
Global nginx congf file location /etc/nginx/nginx.conf.
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

Above method is easy way to install nginx in linux, To install Nginx using Source kindly refer my next post. 
Previous
Next Post »