Installing nginx

Install Nginx
cd /opt
wget http://sysoev.ru/nginx/nginx-0.8.33.tar.gz

tar -zxvf nginx-0.8.33.tar.gz
cd nginx-0.8.33
./configure --with-http_stub_status_module
Other option complied with configure as per requirement
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid  \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
 --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ 

make
make install

useradd -s /sbin/nologin -d /usr/local/nginx/html -M nginx
passwd -l nginx

Quote
Now in File # vi /usr/local/nginx/conf/nginx.conf
Uncomment or edit option
pid               logs/nginx.pid;</p>

user              nginx nginx;

worker_processes  10;

events {
    worker_connections  1024;
}

And in httpd Tagged add lines
#http {

## Common options ##
 include options.conf;

 ## Proxy settings ##
 include proxy.conf;</div>

In File # vi /usr/local/nginx/conf/options.conf</p>

## Size Limits
  client_body_buffer_size     128K;
  client_header_buffer_size   1M;
  client_max_body_size          1M;
  large_client_header_buffers 8 8k;

 ## Timeouts
  client_body_timeout   60;
  client_header_timeout 60;
  expires               24h;
  keepalive_timeout     60 60;
  send_timeout          60;

 ## General Options
  ignore_invalid_headers   on;
  keepalive_requests      100;
  limit_zone gulag $binary_remote_addr 5m;
  recursive_error_pages    on;
  sendfile                 on;
  server_name_in_redirect off;
  server_tokens           off;

 ## TCP options
  tcp_nodelay on;
  tcp_nopush  on;

 ## Compression
  gzip              on;
  gzip_buffers      16 8k;
  gzip_comp_level   6;
  gzip_http_version 1.0;
  gzip_min_length   0;
  gzip_types        text/plain text/css image/x-icon application/x-perl application/x-httpd-cgi;
  gzip_vary         on;

 ## Log Format
  log_format  main  '$remote_addr $host $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" "$http_user_agent" '
                    '"$gzip_ratio"';

In file /usr/local/nginx/conf/proxy.conf</p>

## Proxy caching options
  proxy_buffering           on;
  proxy_cache_min_uses       3;
  proxy_cache_path          /usr/local/nginx/proxy_temp/ levels=1:2 keys_zone=cache:10m inactive=10m max_size=1000M;
  proxy_cache_valid         any 10m;
  proxy_ignore_client_abort off;
  proxy_intercept_errors    on;
  proxy_next_upstream       error timeout invalid_header;
  proxy_redirect            off;
  proxy_set_header          X-Forwarded-For $remote_addr;
  proxy_connect_timeout     60;
  proxy_send_timeout        60;
  proxy_read_timeout        60;</p>
</div>
Edit  file vi /usr/local/nginx/conf/nginx.conf in server tagged
Server {
location /nginx_status {
  stub_status on;
  access_log on;
  allow all;
   # you can specify ip for specific host
#  deny all;
}
•        For nginx_status_url: http://127.0.0.1/nginx_status</p>

Note Make sure line commented in file /usr/local/nginx/conf/nginx.conf

#    sendfile        on;
    #tcp_nopush     on;</p>

    #keepalive_timeout  0;
#    keepalive_timeout  65;

    #gzip  on;

Start nginx web server:
# /usr/local/nginx/sbin/nginx
# netstat -tulpn | grep :80
# echo ' /usr/local/nginx/sbin/nginx' >> /etc/rc.local</div>

comments powered by Disqus