#vi /etc/nginx/nginx.conf
############################################
user nginx nginx;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
upstream tomcat_server {
# ip_hash;
server 192.168.1.17 weight=2;
server 192.168.1.20 max_fails=2 fail_timeout=30s;
}
upstream apache_server {
ip_hash;
server 192.168.1.19;
}
upstream nginx_server {
ip_hash;
server 192.168.1.18;
}
server
{
listen 80;
server_name www.abc.com;
location / {
index index.html index.php index.htm index.jsp index.do default.do;
root html;
if (-d $request_filename)
###############################################
{
rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
}
location ~ \.(jsp|jspx|do)?$ {
proxy_set_header Host %host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://tomcat_server;
}
###############################################
location ~ \.(php|php5)?$ {
proxy_set_header Host %host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://nginx_server;
}
#############################################
location ~ \.(html|htm)?$ {
proxy_set_header Host %host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://apache_server;
}
#############################################
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 1h;
}
#############################################
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

Nginx+Keepalived+Tomcat之动静分离的web集群的更多相关文章

  1. 【Linux运维-集群技术进阶】Nginx+Keepalived+Tomcat搭建高可用/负载均衡/动静分离的Webserver集群

    额.博客名字有点长.. . 前言 最终到这篇文章了,心情是有点激动的. 由于这篇文章会集中曾经博客讲到的全部Nginx功能点.包含主要的负载均衡,还有动静分离技术再加上这篇文章的重点.通过Keepal ...

  2. Nginx动静分离架构&&HA-LB集群整合

    Nginx动静分离简单来说就将动态与静态资源分开,不能理解成只是单纯的把动态页面和静态页面物理分离,严格意义上说应该是动态请求跟静态请求分开,可以理解成使用Nginx处理静态页面,Tomcat,Res ...

  3. Keepalived+LVS 实现高负载均衡Web集群

    一.原理及简介: 1.1 Keepalived简介      Keepalived是Linux下一个轻量级别的高可用解决方案.Keepalived起初是为LVS设计的,专门用来监控集群系统中各个服务节 ...

  4. Keepalived+Nginx+Tomcat 实现高可用Web集群

    https://www.jianshu.com/p/bc34f9101c5e Keepalived+Nginx+Tomcat 实现高可用Web集群 0.3912018.01.08 20:28:59字数 ...

  5. Nginx 和 IIS 实现动静分离

    前段时间,搞Nginx+IIS的负载均衡,想了解的朋友,可以看这篇文章:<nginx 和 IIS 实现负载均衡>,然后也就顺便研究了Nginx + IIS 实现动静分离.所以,一起总结出来 ...

  6. nginx+keepalived+tomcat之tomcat性能调优

    body{ font-family: Nyala; font-size: 10.5pt; line-height: 1.5;}html, body{ color: ; background-color ...

  7. Nginx 和 IIS 实现动静分离【转载】

    前段时间,搞Nginx+IIS的负载均衡,想了解的朋友,可以看这篇文章:<nginx 和 IIS 实现负载均衡>,然后也就顺便研究了Nginx + IIS 实现动静分离.所以,一起总结出来 ...

  8. Nginx 和 IIS 实现动静分离(转)

    转载地址:https://www.cnblogs.com/paul8339/p/5825201.html 动静分离,说白了,就是将网站静态资源(HTML,JavaScript,CSS,img等文件)与 ...

  9. nginx+keepalived+tomcat+memcache实现双VIP高可用及Session会话保持

    Nginx+Keepalived+Tomcat+Memcached 实现双VIP负载均衡及Session会话保持 IP 信息列表: 名称         IP                      ...

随机推荐

  1. Is there a way for me to run Adb shell as root without typing in 'su'?

    Orginal artical :http://android.stackexchange.com/questions/5884/is-there-a-way-for-me-to-run-adb-sh ...

  2. Java中的protected访问修饰符

    在某个类中定义的protected 方法和属性和默认权限方法和属性是一样的.比如,某类的protected 方法和属性在包外是不能通过该类实例进行访问的(你能在包外访问一个类的默认权限的方法和属性吗? ...

  3. Java web 项目 tomcat部署方式.

    本地做Java Web项目的时候常常会用到tomcat部署测试的问题, 这里介绍项目的部署方法: 1,配置文件的形式: 例如: 你的项目目录为:f:\workspaces\MyProject,此时使用 ...

  4. windows 远程桌面连接 RPi 2B

    /************************************************************************* * windows 远程桌面连接 RPi 2B * ...

  5. 【转】Android中visibility属性VISIBLE、INVISIBLE、GONE的区别

    原文网址:http://blog.csdn.net/chindroid/article/details/8000713 在Android开发中,大部分控件都有visibility这个属性,其属性有3个 ...

  6. CSS3 Transitions, Transforms和Animation使用简介与应用展示

    CSS3 Transitions, Transforms和Animation使用简介与应用展示 by zhangxinxu from http://www.zhangxinxu.com本文地址:htt ...

  7. error: Setup script exited with error: Unable to find vcvarsall.bat

    安装mxnet python版本时遇到“Unable to find vcvarsall.bat”错误搜索一下后查到如下方法: python 3.5.2版本依赖高版本的vs解决办法是安装vs2015的 ...

  8. [RQNOJ313]波浪数

    题目描述 波浪数是在一对数字之间交替转换的数,如1212121,双重波浪数则是指在两种进制下都是波浪数的数,如十进制数191919是一个十进制下的波浪数,它对应的十一进制数121212也是一个波浪数, ...

  9. 用户名 不在 sudoers文件中,此事将被报告。

    原文解决方法:http://blog.csdn.net/lincyang/article/details/21020295 CentOS7.0 用到sudo权限的时候出现的问题,如题. sudo命令可 ...

  10. NOIP2004 津津的储蓄计划

    一.津津的储蓄计划 (Save.pas/dpr/c/cpp). [问题描述] 津津的零花钱一直都是自己管理.每个月的月初妈妈给津津300元钱,津津会预算这个月的花销,并且总能做到实际花销和预算的相同. ...