nginx memcache tomcat7 配置

kryo-1.03.jar
kryo-1.03-sources.jar
minlog-1.2.jar
reflectasm-0.9.jar
memcached-session-manager-1.6.3.jar
memcached-session-manager-tc7-1.6.3.jar
msm-kryo-serializer-1.6.3.jar
msm-javolution-serializer-1.6.3.jar
msm-xstream-serializer-1.6.3.jar
msm-flexjson-serializer-1.6.3.jar
javolution-5.4.3.1.jar
spymemcached-2.8.4.jar



conf/context.xml
<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context path="" docBase="ROOT">

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->
			
	<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager" 
	sticky = "false"    
    memcachedNodes="n1:10.10.55.135:11211"     
    requestUriIgnorePattern=".*\.(png|gif|jpg|css|js)$"     
    sessionBackupAsync="false"     
    sessionBackupTimeout="100"     
    transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory"     
    copyCollectionsForSerialization="false"     
    /> 

</Context>




\conf\nginx.conf
#user  nobody;
worker_processes  1;

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

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


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

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    upstream tomcats {
	#ip_hash;
	server 10.10.55.174:8080 weight=1;
	server 10.10.55.135:8080 weight=10;
    }

    server {         
	listen       80;         
	server_name  127.0.0.1;         
	charset utf-8;         
	location / {             
		root   html;             
		index  index.html index.htm;             
		proxy_pass        http://tomcats;             
		proxy_set_header  X-Real-IP  $remote_addr;             
		client_max_body_size  100m;         
	}          
	location ~ ^/(WEB-INF)/ {        
		deny all;          
	}           
	error_page   500 502 503 504  /50x.html;         
	location = /50x.html {             
		root   html;         
	}      
     }




    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        access_log  logs/host.access.log  combined;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}




test.jsp
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<%=session.getId() %><br/>
<%=request.getServerName() %><br/>
<%=request.getServerPort() %><br/>
<%out.print("111111111111"); %><br/>
</body>
</html>

你可能感兴趣的:(memcache)