`
xkorey
  • 浏览: 150861 次
  • 性别: Icon_minigender_1
  • 来自: 石家庄
社区版块
存档分类
最新评论

nginx+tomcat 集群配置之nginx conf 配置

阅读更多
nginx加2台tomcat。session 没有共享。有时间把ssl配置也做以下。

以下是nginx的conf配置文件

user  nginx nginxGroup;
#nginx 启动进程数或线程数
worker_processes  1;

error_log   logs/error.log crit;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;
#打开文件个数的限制
worker_rlimit_nofile 65535;

#用google的缓存工具处理缓存
google_perftools_profiles /tmp/tcmalloc/;

events {
#高性能网络IO模型EPOLL
    use epoll;
#连接数
    worker_connections  65535;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    
    sendfile        on;
    
    keepalive_timeout  65;
 
    #gzip  on;
    
#bogon 是我的主机名字
#集群2个tomcat
    upstream bogon {
	server localhost:8081 weight=2;	
    	server localhost:8082 weight=2;
	ip_hash;
    }
#禁止通过直接ip来访问 
    server{
       server_name _;
       return 404; 	
    }	
	 	
    server {
        listen       80;
        server_name  bogon;
	index index.html inex.htm index.jsp;
        charset utf-8;
#nginx的web目录
	root	/home/nginx/tomcats/files;
	#server_names_hash_bucket_size 128;
	client_header_buffer_size 32k;
	large_client_header_buffers 4 32k;
	client_max_body_size 8m;
        #access_log  logs/host.access.log  main;

        location / {
            
	    client_max_body_size 100m;		
        }
	
	location ~^/(WEB-INF)/{
	     deny all;	
	}
#tomcat 处理 jsp请求	
	location ~ .*.jsp$ {
	    proxy_set_header Host $http_host; 
            proxy_redirect     off; 
            proxy_pass         http://bogon; 
            proxy_set_header   Host             $host; 
            proxy_set_header   X-Real-IP        $remote_addr; 
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;    	
	}
	
	location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|html)$ {
    	     expires 30d;
	} 
	
	location ~ .*\.(js|css)?$ {
	    expires 1h;    
	}
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

      

       
    }


    

}
分享到:
评论

相关推荐

    nginx + tomcat 集群配置

    nginx + tomcat 集群配置 负载 nginx 下载地址: http://nginx.org/en/download.html 联合tomcat 实现集群 windows: Nginx.conf 配置 //见文件夹下面的nginx.conf 更改tomcat的配置: 第一处端口...

    linux下Nginx+tomcat整合的安装与配置

    linux下Nginx+tomcat整合的安装与配置

    Nginx+Tomcat负载均衡

    3.这里只需要修改Nginx的配置,让它通过tomcat来转发,所以我们在这一步只需要在nginx.conf中添加几行代码就行。 如果看不懂 。建议直接拿我替来用。 Copy下面的内容 替换 你的nginx.conf注意黄色端口要改为你的。 ...

    nginx+tomcat+memcache集群缓存配置及介质

    主要配置nginx conf文件 增加以下内容 upstream mytomcats { server localhost:8080; server localhost:8081; } ">一 安装 1 jdk安装及tomcat7解压缩安装配置 不用说明 2 下载nginx1 4 2 for win32 解压安装 ...

    nginx+tomcat+session+ssl_https+http

    整个环境解压既可以使用,证书如果需要修改,直接将证书放在nginx的config目录,然后修改nginx.conf配置文件中的https配置节点的证书名称就可以了。 http https session memcached nginx tomcat

    nginx+tomcat7+session共享 kryo序列化所需要包

    nginx+tomcat7+session共享 kryo序列化所需要包 1.将上面所提到的包全部拷贝到tomcat的lib下(三台tomcat都需要) 2.修改每台tomcat的conf目录下得context.xml文件或者server.xml文件,在其中加入如下任意一段代码...

    tomcat8 + nginx + memcached + cas 实现负载均衡的配置包

    1.1修改tomcat8.x/conf/context.xml的配置如下: <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this ...

    详解基于Centos7+Nginx+Tomcat8的负载均衡服务器的搭建

    由于工作的需求,在使用中,需要搭建负载均衡,研究了Apache+Tomat负载均衡的方案,并且通过检索相关的文章,进行了比较发现,Apache负载负载均衡在使用的效率上,远远...在conf的nginx.conf的文件中加入了:include

    tomcat+nginx反向代理集群配置.zip

    配置tomcat+nginx所需要的全部文件...tomcat+nginx反向代理集群配置.zip -------------------------------------- memcached memcached-1.6.5的jar nginx.conf nginx-1.4.7.zip tomcat1-server.xml tomcat2-server.xml

    Nginx+Tomcat搭建高性能负载均衡集群的实现方法

    一、 目标实现高性能负载均衡的Tomcat集群: 二、步骤 1、首先下载Nginx,要下载稳定版: 2、然后解压两个Tomcat,分别命名为apache-tomcat-6.0.33-1和apache-tomcat-6.0.33-2: 3、然后修改这两个Tomcat的...

    Nginx + Tomcat + HTTPS极速配置

    作者:RKun595,来自原文地址  ...所以不再赘述.  进入下载证书页面  (此图片来源于网络,如有侵权,请联系删除!...然后修改nginx配置文件 sudo vi /etc/nginx/nginx.conf  加上一个监听服务   upstream tomcat

    简单实现nginx+tomcat的反向代理与动静分离

    windows下测试 nginx+tomcat实现java web项目的动静分离 1. 安装nginx,访问静态资源 ...修改配置文件nginx.conf,添加如下配置:  #正则匹配以static开头的请求,比如/test1/static/js…  locatio

    Nginx Tomcat集群部署说明

    一份不错的Nginx Tomcat集群部署说明

    nginx memcached tomcat8负载均衡配置文件

    1 jdk安装及tomcat8解压缩安装配置 不用说明 2 解压附件里的压缩包里的memcached-win64-1.4.4-14.zip 命令行cd 到根目录然后执行 (1)memcached.exe -d install (2)memcached.exe -d start 2 解压附件里的压缩包...

    2.nginx.conf的配置(负载均衡的配置)和tomcat(session共享).md

    本文档解决配置nginx 配置文件后 ,所引发的tomcat集群session不共享的处理方案,本文档有详细说明

    通过Nginx搭建Tomcat9集群并实现Session共享

    修改nginx.conf配置文件,实现集群 3.Redis实现Session 共享 在tomcat/lib 目录下添加以下三个jar 包 然后更改tomcat的context.xml文件 然后先启动redis服务,然后启动tomcat和nginx的服务。 您可能感兴趣的文章...

    tomcat+nginx域名配置方法

    找到nginx/conf/nginx.conf,做如下关键配置: upstream xx{ #配置upstream节点,这里节点名为“xx” server 116.255.111.111:8080; } server{ listen 80; server_name www.xxx.xx; #这里

    2.nginx.conf的配置(负载均衡的配置)和tomcat(session共享).doc

    如何解决Nginx的负载均衡的配置?如何解决使用nginx负载均衡后留下session不同步的隐患? Tomcat的session共享有几种解决方案?文档中均有涉及!欢迎大家转载!

    Ngxin+双tomcat负载+mem做session共享

    Tomcat集群 目录 Tomcat集群 1 一、环境介绍: 1 ...6.2 修改nginx.conf配置文件 6 6.3 修改conf.d/xiaoxin.conf 6 6.4 修改tomcat中的server.xml文件 7 6.5放入项目文件 7 七、测试 7 八、关于tomcat的轮训模式 8

    nginx生产环境配置+错误页面+jar启动终止脚本

    包含了springboot 打包jar部署的一键启动和终止脚本(.sh)、nginx生产环境配置文件(.conf)参考示例和自定义错误页面资源,适合中小公司(个人)Linux系统部署springboot项目

Global site tag (gtag.js) - Google Analytics