NGINX SERVER INSTALLATION

NGINX SERVER INSTALLATION

NGINX?

Nginx  {pronounced Engine-X} is a free, open source, less hungry resource, high-performance WEB-SERVER & Reverse Proxy Server, We can also use  it as IMAP/POP3  proxy server. All credit goes to Mr.Igor Sysoev the author of Nginx who developed it in 2002 with the first public release in 2004 and now its growing & growing.  Nginx now hosts nearly 13% of active sites across the world.

Why we use Nginx?

First of all  its complete replacement of Apache web-server. But it’s not the main reason to  use Nginx web-server. Mainly Nginx is known for its higher performance , stability, rich feature set, simple configurations and less resource consumption’s. Nginx is one of a handful of server written to address the c10K Problem (it’s time for web server to handle ten thousand clients simultaneously).

 

Lastes Release of Nginx.

1)      Nginx-1.4.1 is the lasted stable version and it released 07-05-2013.

2)      Nginx-1.4.0 stable version  released 24-04-2013.

3)      Nginx-1.2.8 stable version  released 02-04-2013.

4)      Nginx-1.2.7 stable version  released 12-02-2013.

 

Nginx Packages Availibitly :-

Nginx packages available for both window and Linux. But we suggest you don’t run Nginx with window server in production environment. Nginx run very smooth & reliable with Linux based server so if you think about to run Nginx server in production environment then you guys must run it with Linux based server.

Nginx Installations on Linux Ubuntu12.04/Debian-7 Server:—

1)      We have two method to install Nginx First one is to download source package and then compile it and second to install by repository. Here we will install it by repository but Ubuntu/Debain OS repository provide you Nginx-1.1.9 stable version.

Lets take example:—

root@test:~# apt-get install nginx

root@test:~# nginx -v

nginx version: nginx/1.1.19

root@test:~#

But we need the latest version of Nginx so need to add thirdy PPA party repository.

How to add third party repository to install Nginx-1.4.1:— 

root@test:~# add-apt-repository ppa:nginx/stable

root@test:~# apt-get update

root@test:~# apt-get install nginx

root@test:~# /etc/init.d/nginx start

* Starting nginx nginx [ OK ]
root@test:~#

root@test:~# nginx -v

nginx version: nginx/1.4.1
root@test:~#

How to check Nginx is working or not working:—

root@test:~# nmap localhost

PORT STATE SERVICE
22/tcp open ssh
80/tcp open http

Nmap done: 1 IP address (1 host up) scanned in 0.07 seconds
root@test:~#

Here nmap show us the port 80 is open that means the web services Nginx is working , lets check it on browser http://localhost or http://ip-address.

nginx1

 

 

 

 

Nginx configurations files:–

       In Nginx Server we have  a lot of configuration files and all these files are stored under /etc/nginx/

1)      /etc/nginx/nginx.conf 

Main configurations file of nginx server , same as httpd.conf in Apache REDHAT Or apache2.conf in Debian/Ubuntu Apache server.

 2)      /etc/nginx/conf.d/*.conf

Additional configuration for Nginx Virtual host server or Nginx server modules.

 3)      /etc/nginx/sites-available/default

Default Nginx Virtual server host file.

4)      /usr/share/nginx/html/

Default root dir of website.  

5)      /usr/share/doc/nginx/

Documentions file of nginx server

6)      /etc/init.d/nginx

Niginx  server services (STOP/START) script

 

How to change Default page of Nginx webserver:—

root@test:~# cd /usr/share/nginx/html/

root@test:/usr/share/nginx/html# ls
50x.html index.html
root@test:/usr/share/nginx/html#

root@test:/usr/share/nginx/html# >index.html (Empty Default file)

root@test:/usr/share/nginx/html# echo "Hello Test Page How2install.in" >index.html

root@test:/usr/share/nginx/html# /etc/init.d/nginx restart
* Restarting nginx nginx [ OK ]
root@test:/usr/share/nginx/html#

Let’s Check it on browser:–
open browser and type http://localhost or http://ip-address

nginx2

Leave a Reply

Time limit is exhausted. Please reload the CAPTCHA.