This article mainly describes the configuration of the Nginx-1.9.6+tomcat8+memcached-win32-1.4.4+session share for Windows Server 2008-32-bit standalone
Chapter One: Installing the configuration memcached-win32-1.4.4 to share tomcat8 session information later
1. Download server memcached software: http://blog.couchbase.com/memcached-144-windows-32-bit-binary-now-available
2, memcached basic parameter setting:
-P Listening Port
-L connected IP address, default is native
- D start memcached service
- d Restart Restart memcached service
-D Stop|shutdown Close the running memcached service
- D install memcached service
- D Uninstall uninstall memcached service
-U Run as (only valid when running as root)
-m maximum memory usage, in megabytes. Default 64MB
-M running out of memory and returning an error instead of deleting an item
-C Maximum number of simultaneous connections, default is 1024x768
-F Block size growth factor, default is 1.25
-N Minimum allocated space, key+value+flags default is
- h Display Help
3. Run Cmd.exe as Administrator and go to the folder where Memcached is located, for example:
|
cd D:\wamp_win7\bin\memcached-win32-1.4.4 |
Note: If you do not run as an administrator, you will get an error "failed to install service or service already installed"
4, installation memcached:
memcached.exe -d install -m 500 -c 2048
(After the screen does not have any prompts, you can again [Control Panel]->[management tool]->[service] to see memcached)
5, starting Memcached:[Control Panel]->[management Tool]->[Service] Find memcached service
Startup type: Select "Auto"
Service status: Click "Start" Below "
Chapter II: Installation Configuration apache-tomcat-8.0.28-windows-x86
The first step is to download the dependency package: http://download.csdn.net/download/xuzhaoshan/9264151
Copy the downloaded jar package to the Tomcat8 's Lib directory (required).
To set up the JDK for tomcat8, add the JDK path in the Setclasspath.bat file:
Set Java_home= "D:\Tomcat8-Cluster\jdk1.8"
Set Jre_home= "D:\Tomcat8-Cluster\jre1.8"
1, Configuration Tomcat-8-1
Configure the Context.xml file for the Conf directory with the following contents:
<?xml version= ' 1.0 ' encoding= ' utf-8 '?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<manager classname= "De.javakaffee.web.msm.MemcachedBackupSessionManager"
Memcachednodes= "n1:localhost:11211"
Sticky= "false"
Sessionbackupasync= "false"
Lockingmode= "None"
Requesturiignorepattern= ". *\. (ICO|PNG|GIF|JPG|CSS|JS) $ "
transcoderfactoryclass= "De.javakaffee.web.msm.JavaSerializationTranscoderFactory"/>
</Context>
Configure the Server.xml file for the Conf directory with the following contents:
<?xml version= ' 1.0 ' encoding= ' utf-8 '?>
<server port= "8005" shutdown= "Shutdown" >
<listener classname= "Org.apache.catalina.startup.VersionLoggerListener"/>
<listener classname= "Org.apache.catalina.core.AprLifecycleListener" sslengine= "on"/>
<listener classname= "Org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<listener classname= "Org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<listener classname= "Org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources>
<resource name= "Userdatabase" auth= "Container"
Type= "Org.apache.catalina.UserDatabase"
description= "User database that can be updated and saved"
factory= "Org.apache.catalina.users.MemoryUserDatabaseFactory"
Pathname= "Conf/tomcat-users.xml"/>
</GlobalNamingResources>
<service name= "Catalina" >
<executor name= "Tomcatthreadpool" nameprefix= "catalina-exec-" maxthreads= "60000" maxidletime= " Minsparethreads= "/>"
<connector port= "Bayi" protocol= "Org.apache.coyote.http11.Http11AprProtocol"
Executor= "Tomcatthreadpool" compression= "on" compressionminsize= "2048" nocompressionuseragents= "Gozilla, Traviata"
Compressablemimetype= "text/html,text/xml,text/javascript,text/css,text/plain,application/json,application/ X-javascript "
Maxthreads= "30000" minsparethreads= "enablelookups=" false "acceptcount=" 35000 "
connectiontimeout= "40000" disableuploadtimeout= "true" uriencoding= "UTF-8" usebodyencodingforuri= "true" redirectport= "8443"/>
<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>
<engine name= "Catalina" defaulthost= "192.168.1.2" jvmroute= "Tomcat8-1" >
<realm classname= "Org.apache.catalina.realm.LockOutRealm" >
<realm classname= "Org.apache.catalina.realm.UserDatabaseRealm" resourcename= "Userdatabase"/>
</Realm>
<context path= "" docbase= "D:\Tomcat8-Cluster\ project name" reloadable= "false"/>
</Host>
</Engine>
</Service>
</Server>
1, Configuration Tomcat-8-2
Configure the Context.xml file for the Conf directory with the following contents:
<?xml version= ' 1.0 ' encoding= ' utf-8 '?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<manager classname= "De.javakaffee.web.msm.MemcachedBackupSessionManager"
Memcachednodes= "n1:localhost:11211"
Sticky= "false"
Sessionbackupasync= "false"
Lockingmode= "None"
Requesturiignorepattern= ". *\. (ICO|PNG|GIF|JPG|CSS|JS) $ "
transcoderfactoryclass= "De.javakaffee.web.msm.JavaSerializationTranscoderFactory"/>
</Context>
Configure the Server.xml file for the Conf directory with the following contents:
<?xml version= ' 1.0 ' encoding= ' utf-8 '?>
<server port= "8006" shutdown= "Shutdown" >
<listener classname= "Org.apache.catalina.startup.VersionLoggerListener"/>
<listener classname= "Org.apache.catalina.core.AprLifecycleListener" sslengine= "on"/>
<listener classname= "Org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<listener classname= "Org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<listener classname= "Org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources>
<resource name= "Userdatabase" auth= "Container"
Type= "Org.apache.catalina.UserDatabase"
description= "User database that can be updated and saved"
factory= "Org.apache.catalina.users.MemoryUserDatabaseFactory"
Pathname= "Conf/tomcat-users.xml"/>
</GlobalNamingResources>
<service name= "Catalina" >
<executor name= "Tomcatthreadpool" nameprefix= "catalina-exec-" maxthreads= "60000" maxidletime= " Minsparethreads= "/>"
<connector port= "protocol=" Org.apache.coyote.http11.Http11AprProtocol "
Executor= "Tomcatthreadpool" compression= "on" compressionminsize= "2048" nocompressionuseragents= "Gozilla, Traviata"
Compressablemimetype= "text/html,text/xml,text/javascript,text/css,text/plain,application/json,application/ X-javascript "
Maxthreads= "30000" minsparethreads= "enablelookups=" false "acceptcount=" 35000 "
connectiontimeout= "40000" disableuploadtimeout= "true" uriencoding= "UTF-8" usebodyencodingforuri= "true" redirectport= "8444"/>
<connector port= "8010" protocol= "ajp/1.3" redirectport= "8444"/>
<engine name= "Catalina" defaulthost= "192.168.1.2" jvmroute= "Tomcat8-2" >
<realm classname= "Org.apache.catalina.realm.LockOutRealm" >
<realm classname= "Org.apache.catalina.realm.UserDatabaseRealm" resourcename= "Userdatabase"/>
</Realm>
<context path= "" docbase= "D:\Tomcat8-Cluster\gy" reloadable= "false"/>
</Host>
</Engine>
</Service>
</Server>
Chapter III: Installation Configuration nginx-1.9.6
First to download nginx-1.9.6, modify the nginx.conf file, as follows:
#user nobody;
#工作进程数: This value is configured according to the number of server CPU cores, such as 6-core 12-thread CPU can be configured to 6 or 12.
Worker_processes 4;
#错误日志存放路径
#error_log Logs/error.log;
#error_log Logs/error.log Notice;
#error_log Logs/error.log Info;
#pid Logs/nginx.pid;
Events {
#设置单个进程同时打开的最大连接数, this value is set larger to accept more connections, of course, this requires CPU and memory support OH ~ ~
Worker_connections 1024;
}
HTTP {
Include Mime.types;
Default_type Application/octet-stream;
Sendfile on;
Keepalive_timeout 65;
#gzip on;
# The Tomcat server information is set here, and Tomcat may not be on the same host. There are two Tomcat services set up here, with a weighting of 1:1. localhost replaced with the IP of the server
Upstream 192.168.1.2{
server 192.168.1.2:81 max_fails=0;
Server 192.168.1.2:82 max_fails=0;
#ip_hash;
}
server {
Listen 80;
server_name 192.168.1.2;
CharSet Utf-8;
Location/{
root HTML;
Index index.html index.htm;
Proxy_pass http://192.168.1.2;
Proxy_redirect default;
}
#error_page 404/404.html;
# REDIRECT Server error pages to the static page/50x.html
Error_page 502 503 504/50x.html;
Location =/50x.html {
root HTML;
}
}
}
Startup mode, you can save the command as a. bat file for easy operation
Start: Start Nginx
Stop: Nginx-s stop
Reload: Nginx-s Reload
Distributed Deployment One (Windows server 2008-32-bit stand-alone)