wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
#获取rpm包
rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum install nginx
service nginx start
nginx的几个默认目录
1 配置所在目录:/etc/nginx/
2 PID目录:/var/run/nginx.pid
3 错误日志:/var/log/nginx/error.log
4 访问日志:/var/log/nginx/access.log
5 默认站点目录:/usr/share/nginx/html
关闭掉selinux
# /usr/sbin/setenforce 0 立刻关闭 SELINUX
#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/rc.d/init.d/iptables save
配置文件如下
worker_processes 8;
events {
worker_connections 8024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
client_max_body_size 32M;
upstream tomcats {
ip_hash;
server 192.168.1.60:8080;
server 192.168.1.53:8080;
server 192.168.1.55:8080;
}
server {
listen 80;
server_name www.tianxianyun.com;
location /{
proxy_pass http://tomcats;
}
}
}