rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/i386/epel-release-6-5.noarch.rpm

rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/i386/ius-release-1.0-10.ius.el6.noarch.rpm

rpm -Uvh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

 

 

yum install nginx

 

service nginx start

 

 

vi /etc/nginx/nginx.conf

user  nginx;

worker_processes  1;

error_log  /var/log/nginx/error.log warn;

pid        /var/run/nginx.pid;

events {

worker_connections  1024;

}

http {

include       /etc/nginx/mime.types;

default_type  application/octet-stream;

 

log_format  main  ‘$remote_addr – $remote_user [$time_local] “$request” ‘

‘$status $body_bytes_sent “$http_referer” ‘

‘”$http_user_agent” “$http_x_forwarded_for”‘;

access_log  /var/log/nginx/access.log  main;

sendfile        on;

#tcp_nopush     on;

keepalive_timeout  65;

#gzip  on;

# include /etc/nginx/conf.d/*.conf;

upstream site {

#ip_hash;

server 192.168.1.4:80 weight=5;

server 192.168.1.5:80 weight=10;

}

server{

listen 80;

server_name site;

location / {

root html;

index index.html;

proxy_pass http://site;

}

}

}


相关参阅:http://www.antcaves.com/index.php/2016/05/05/nginx/