Menu

Wednesday 28 November 2018

What is Nginx & How to install on RHEL

NGINX is an open-source web server used by more than 409 million websites and over 63% of the world’s top 10,000 websites.

NGINX Inc. is the company that created that software, and they sell NGINX Plus and more software products to IT professionals in companies all over the globe.

   Similarities between Nginx & Apache:

   1. Free and open source software.
   2. Community for the users, reviewing code.
   3. Can be Added functionality through dynamic modules.
   4. Reverse Proxy servers can be done.
   5. Event-based processing for the large number simultaneous connections.


   Differences between Nginx & Apache:



   Why Nginx?
  • .       Market-leading web server.
  • .       It’s too efficient & easy to enable 3rd party modules.
  • .       It's consistent in performance under heavy load.
  • .       Needed fewer hardware resources to serve the requests.
  • .       Easy to install and configure.
  • .       Upgrade on running instance, no downtime needed during the up-gradation of Nginx.
  • .       Scalable in the concurrent connection handling.
  • .     NGINX is one of a handful of servers written to address the C10K problem.



   Installation on RHEL 7
         Two methods to install Nginx on the server :
1.       Using Pre-compiled binaries.
2.       Compile using a Source-file.


 Method 1:   Using Pre-compiled binaries.

  I am installing Nginx on "google-cloud"  RHEL 7 server.


 Step 1: Prepare the build environment.
To ensure your build environment has these prerequisites installed, run the appropriate command.
 
Command :  yum  install  -y  gcc  gcc-c++   make   pcre-devel   zlib-devel   expat-devel   mailcap   openssl*  





 Step 2: Install Nginx using the below command.

       Command: yum  install  nginx



 Step 3: Create a service of nginx using below command.

Command : chkconfig  nginx  on 





 Step 4: Start the nginx through command.

Command:  systemctl   start   nginx





 Step 5: Check the Nginx version.

Command: nginx  -V






 Step 6: Check through the browser, use your IP address.




 Step 7:  "Nginx" directories and its descriptions.

    

Directories
Descriptions.
/etc/nginx/
Config dir.
/etc/nginx/nginx.conf
Master/Global config file.
/usr/share/nginx/html
Document root directory
/etc/nginx/conf.d
Extra configuration files.
/var/log/nginx
log location folder (access.log & error.log).
/usr/sbin/nginx
Main nginx file location.



 Step 8:  "Nginx" useful commands and its descriptions.


Commands
Descriptions.
nginx -s  [signal]
Signal (Where signal may be one of the following).
nginx -s  stop
Fast Shutdown.
nginx -s quit
Graceful shutdown (to stop nginx processes with waiting for
the worker processes to finish serving current requests).
nginx -s reload
Reloading the configuration file (Changes made in the configuration file will not be applied until the command to reload configuration is sent to Nginx or it is restarted).
nginx  -s reopen
Reopening the log files.
nginx   -t
To test the configuration file (nginx.conf).
nginx   -T
To test configuration, dump it and exit.
nginx  -V
Show version and configure options then exit.
nginx  -v
Show version and exit.
nginx  -h
This is print help.
nginx  -c  filename
Specify which configuration file NGINX should use instead of the default.
nginx  -T | less
To test configuration, dump it &  page wise view.



Nginx-Docs link:
https://drive.google.com/drive/folders/1jg43W_m0D72tKU5yK4nVEqUuLEYy3pP9

Reference links :
https://www.nginx.com/resources/wiki/
http://nginx.org/en/docs/
https://docs.nginx.com/nginx/admin-guide/
https://www.digitalocean.com/community/tutorials/
https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-plus/



Thanks, folks :-)

Monday 5 November 2018

Install LAMP on SUSE Linux with Real time application example.


LAMP is generally stands for “Linux, Apache, MySQL (Maria-DB), and PHP

LAMP is an open source Web development platform that uses Linux as the operating system,
Apache as the Web server, MySQL as the relational database management system and PHP as the object-oriented scripting language.





Step 1: Install a UNIX/Linux server.
             I am using SUSE Linux operating system.


Step 2: Install Apache server.

Command:#   zypper  install httpd




Step 3: Create a symlinks to start & stop the apache through services.

Command:#    systemctl enable apache2





Step 4:  Start the Apache services.

Command:#   systemctl  start apache2




Step 5: Check the repos of suse linux.

Command:# zypper repos




Step 6: refresh the repos.

Command:#   zypper refresh




Step 7: Install "php"  libraries.

Command:#   zypper in php5*





Step 8: Check information pattern of lamp server.

Command:#   zypper info -t pattern lamp_server





Step 9: Install lamp server pattern. & press y to view the notification for Database.

Command:#   zypper in -t pattern lamp_server





Step 10: Start the mysql database.

Command:#   rcmysql start


Step 11: Check the status for mysql database.

Command:#   rcmysql status

Command:#   chkconfig  -a mysql





Step 12: Set a password for root user in database.

Command:#    '/usr/bin/mysqladmin'    -u root   password 'suse'


 You also change the database password through below command.

 Command: #    '/usr/bin/mysql_secure_installation'





Step 13: Create a new php page on apache.

Command:#   vi /srv/www/htdocs/info.php

<?php
phpinfo();
?>




Also, un-comment the 873 line on below located  php.ini file

 Command:#   vi   /etc/php5/apache2/php.ini

872 ;extension=php_ldap.dll
873  extension=php_mbstring.dll
874 ;extension=php_exif.dll





Step 14: enable php5 module to use in apache configuration.

Command:#   a2enmod  php5



Step 15: Restart the apache2 service & Check the apache url.

Command:#    systemctl restart apache2.service



Step 16: Give full permission to php5 libraries.

Command:#   chmod -R  777  /var/lib/php5/

Command:#    systemctl restart apache2






Step 17: Now,  We have to install phpMyAdmin & pwgen repos lib files.

Use below link to download: 

https://drive.google.com/open?id=1xlHmFOa8B7MjUrInx-Eq3jygEXk-Hksq
https://drive.google.com/open?id=1xkQXBVpzV1OnsC9d_hcrcTIXGm9LbKvd



Step 18: Install both the rpm pwgen & phpMyAdmin libraries.

Command:#   rpm  -ivh  pwgen-2.07-3.1.x86_64.rpm
Command:#   rpm -ivh   phpMyAdmin-4.8.3-29.1.noarch.rpm

Command:#   systemctl restart apache2












Step 19: Using Opensource "osticket" application , a real time example.

Download link:#   https://osticket.com/download/

Unzip the osTicket-v1.10.4.zip  & move the upload folder to Apache "/srv/www/htdocs/"

& rename as osticket






Step 20 : Now, you have  successfully installed  osTicket on LAMP.










Thanks :-)