Question : what is nginx server ?
Question : how to configure nginx server in linux, centos ?
Question : say about nginx feature ?
Server IP  - 10.20.2.33
OS  - CentOS 6
Hostname - lokesh.khandwa.com
Nginx is a web server like Apache. It can work as reverse proxy for HTTP, https, smtp,pop3 and imap. It’s pronounces “ Engine X”.
Feature
- Reverse/mail proxy with caching
- Load balancing
- TLS/SSL supported
- Virtual server with name and ip based
- Gzip compression and decompression
- Fault tolerance
- Handle thousand simultaneous connection
Default directories and files
document root : /usr/share/nginx/html
configuration file: /etc/nginx/nginx.conf
Virtual host configuration directory: /etc/nginx/conf.d/
Virtual host configuration file: /etc/nginx/conf.d/default.conf
First we need to install  and enable repo for Nginx server
[root@khandwa ~]# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
         Or  enable epel-release repo
         [root@khandwa ~]# yum install epel-release
Step 2
Install nginx server package
[root@khandwa temp]# yum install nginx*
Step 3
Start Nginx Service 
[root@khandwa temp]# service nginx restart
Start on every boot
[root@khandwa temp]# chkconfig nginx on
Check status 
[root@khandwa temp]# service nginx status
           nginx (pid  3914) is running...
Step 4 
Configure iptabeles 
#iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
#iptables -A INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT
# service iptables save
# service iptables restart
ORDisable IPtables
# service iptables stop
# chkconfig iptables off
Step 5
Access nginx server on browser
http://10.20.2.33
Step 5
Configuration 
Create Directory
[root@khandwa /]# mkdir /webserver
[root@khandwa /]# mkdir /webserver/linuxtopic.com
Create index file
[root@khandwa /]# vi /webserver/linuxtopic.com/index.html
insert mode and past following test coding.
<html>
<head>
     <title> Linux Topic </tilte>
</head>
<body>
   <h1> Well come to linuxtopic.com </h1>
</body>
</html>
Step 6
Create basic configuration file for linuxtopic.com website:copy default configuration file and edit
# cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/linuxtopic.com.conf
server {
    listen       80;          # port setting 
    server_name  linuxtopic.com;         # server setting 
    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;
    location / {
        root   /webserver/linuxtopic.com;   # document root 
        index  index.html index.htm;
    }
    #error_page  404              /404.html;
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /linuxtopic.com;   # document root 
    }
    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
   # }
}
Restart Server
Step 7
host entry
10.20.2.33 linuxtopic.com
[root@khandwa temp]# service nginx restart
Step 7
host entry
# vi /etc/hosts# it's your host file
10.20.2.33 linuxtopic.com





