首先先了解什么是nginx:
http://cxshun.iteye.com/blog/1535188
图片来自其他
从上图可以了解到整个集群的部署框架
安装地址:
http://www.iteye.com/topic/1125301
nginx 配置后出现的问题:
js,css,png...等显示不了?
1,查看页面源代码发现:读取js,css,png等信息时,系统去读取了“http://tomcat_service/项目名称/css..."tomcat_service 为配置多个服务器的名称,很显然这样是错误的!
多次搜索了”nginx css,js,png无法显示“却没有得到答案,突然发现:
- location / {
- proxy_pass http://tomcat_service
- proxy_redirect default;
- proxy_connect_timeout 10; (跟代理服务器连接的超时时间,必须留意这个time out时间不能超过10秒.当一台服务器当掉时,过10秒转发到另外一台服务器)
- }
上面没有添加头格式!如下:
- proxy_set_header X-Real-IP $remote_addr;
- client_max_body_size 100m;