#安装Nginx并启动 [root@E-host tools]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo //修改epel源 [root@E-host tools]# yum install pcre* openssl* -y [root@E-host tools]# useradd nginx -s /sbin/nologin -M [root@f-host tools]# tar xf nginx-1.6.2.tar.gz [root@f-host tools]# cd nginx-1.6.2 [root@E-host tools]# ./configure --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --prefix=/application/nginx [root@E-host tools]# make [root@E-host tools]# make install [root@E-host tools]# /application/nginx/sbin/nginx -t [root@E-host tools]# /application/nginx/sbin/nginx [root@f-host nginx-1.6.2]# /etc/init.d/iptables stop
1.配置文件nginx.con
http://nginx.org/en/docs/http/ngx_http_upstream_module.html
#HTTP标签添加
upstream fzjhtest {
server 192.168.1.10:80 max_fails=3 fail_timeout=30s;
server 192.168.1.14:80 max_fails=3 fail_timeout=30s;
}
server {
listen 80;
server_name fzjh.test.org;
index index.html index.htm;
location / {
proxy_pass http://fzjhtest;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}#sesson共享问题 解决方法1:lb层,upstream下更改调度算法,ip_hash; cookie insert PHP,JAVA 解决方法2:共享 memcache,nosql 等(常用) 解决方法3:cookies, 解决方法4:软件层:tomcat,resin couchbase
多虚拟机代理问题
location /{
proxy_pass http://fzjhtest;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}

桂ICP备16010384号-1
停留在世界边缘,与之惜别