Pages

Thursday, January 17, 2013

How to install Nginx on linux and configure with apache.

1.Download tar form mention link http://nginx.org/download/nginx-1.3.11.tar.gz
2.untar with tar -zxvf nginx-1.3.11.tar.gz
3.compile ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-
  http_realip_module --with-http_ssl_module --user=nobody --group=nobody --with-
  http_realip_module.
4.make && make install
5.Start apache with 8080 port instead of 80.
6. Now vi /usr/local/nginx/conf/nginx.conf

7. add following line 


server {
     listen 80;
     server_name www.domain.com domain.com;

     location / {
         root /var/www/domain.com/html;
         index index.html index.htm;
     }

}



location {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://localhost:8080;

                proxy_buffer_size          64k;
                proxy_buffers              32 64K;
                proxy_busy_buffers_size    64k;
                proxy_temp_file_write_size 64k;
                client_max_body_size    5m; #Set max body size to 5Mb
        }


8. Now this is time to start nginx service on server run following command.
 /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

No comments:

Post a Comment