Showing posts with label Installation of Ngnix. Show all posts
Showing posts with label Installation of Ngnix. Show all posts

Friday 16 February 2018

Best Advantage for NGINX



NGINX also has a rich set of features and can perform various server roles:

 

1 - A reverse proxy server for the HTTP, HTTPS, SMTP, POP3, and IMAP protocol

2 - A load balancer and an HTTP cache

3 - A frontend proxy for Apache and other web servers, combining the flexibility of Apache with the good static content performance of NGINX


NGINX supports FastCGI and SCGI handlers for serving dynamic content scripts such as PHP and Python. It uses the LEMP stack: a variation of LAMP using the phonetic spelling of NGINX (Linux, “En-juhn-ex,” MySQL, PHP).



Therefore to install Nginx the following command you can see blow....

 Installation of Ngnix

 To add the CentOS 7 EPEL repository

        yum install epel-release



Install Nginx

yum install nginx



Start Nginx

systemctl start nginx



Allow from firewall

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

firewall-cmd --permanent --zone=public --add-service=https

firewall-cmd  --reload



enable Nginx to start when your system boots
        systemctl enable nginx
  
default server root directory is
        /usr/share/nginx/html

Configuration


                /etc/nginx/nginx.conf       
 

Installation of PHP

To add his PHP repository, run the following command

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

 
This pulls in the package and adds the repository to YUM. It is being added disabled, though, so we have to enable that manually. So, open the repository file:
vi /etc/yum.repos.d/remi.repo

 
cut out the ‘remi-php55’ and ‘remi-php56’  block as we want PHP 7.0. 
vi /etc/yum.repos.d/remi-php70.repo
To enable repository, you have to change ‘enabled=0’ into ‘enabled=1’.
 


yum install php-fpm php-cli php-common php-mbstring php-gd php-intl php-xml php-mysql php-mcrypt php-zip php-curl
php –v

 

 To ensure it also starts automatically with the server, run
        systemctl enable php-fpm
  

To find a file
        find / -name php-fpm.conf
 
 Change both the user and the group to nginx
        vi /etc/php-fpm.d/www.conf
 
 
 

/etc/nginx/nginx.conf
 
add the following content to it:
        location ~\.php$ {
             try_files $uri =404;
             fastcgi_pass   127.0.0.1:9000;
             fastcgi_index  index.php;
       fastcgi_param SCRIPT_FILENAME                  
       $document_root$fastcgi_script_name;
             include fastcgi_params;
       }
 Restart nginx
        systemctl stop nginx
        systemctl start nginx
        
Restart php-fpm
        systemctl status php-fpm.service
        systemctl stop php-fpm.service
        systemctl start php-fpm.service
 
NginX has been marked to record high performance than Apache. NginX require very less memory as far more clients 
can be supported with minimum or no thread. Hence very little memory is utilized as compared to Apache which needs 
one thread/process or each client.

For more information, you may visit our social channels click on icons to go-


Innverse Twitter        Innverse Facebook         Innverse G+         Innverse Linkedin        Innverse Tumblr        Innverse Pinterest