# 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 {
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;
# New 1 start ---------------
Server_names_hash_bucket_size 128;
Client_header_buffer_size 32 K;
Large_client_header_buffers 4 32 K;
Client_max_body_size 8 m;
# New 1 end -----------
Sendfile on;
# Tcp_nopush on;
Keepalive_timeout 65;
# Tomcat add start <
Tcp_nodelay on;
Client_body_buffer_size 512 K;
Proxy_connect_timeout 5;
Proxy_read_timeout 60;
Proxy_send_timeout 5;
Proxy_buffer_size 16 K;
Proxy_buffers 4 64 K;
Proxy_busy_buffers_size 128 K;
Proxy_temp_file_write_size 128 K;
# Tomcat add end>
Gzip on;
# News2 start --
Gzip_min_length 1 K;
Gzip_buffers 4 16 K;
Gzip_http_version 1.1;
Gzip_comp_level 2;
Gzip_types text/plain application/X-JavaScript text/CSS application/XML;
Gzip_vary on;
Upstream tomcat_server {
Server 192.168.0.29: 8035;
Server 192.168.0.27: 8090;
}
Server {
Listen 8088;
SERVER_NAME 192.168.0.104;
Charset UTF-8;
Location /{
Proxy_pass http: // tomcat_server;
}
}
}
Tomcat
<Engine name = "Catalina" defaulthost = "localhost" jvmroute = "A">
Multiple servers
# 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 {
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;
# New 1 start ---------------
Server_names_hash_bucket_size 128;
Client_header_buffer_size 32 K;
Large_client_header_buffers 4 32 K;
Client_max_body_size 8 m;
# New 1 end -----------
Sendfile on;
# Tcp_nopush on;
Keepalive_timeout 65;
# Tomcat add start <
Tcp_nodelay on;
Client_body_buffer_size 512 K;
Proxy_connect_timeout 5;
Proxy_read_timeout 60;
Proxy_send_timeout 5;
Proxy_buffer_size 16 K;
Proxy_buffers 4 64 K;
Proxy_busy_buffers_size 128 K;
Proxy_temp_file_write_size 128 K;
# Tomcat add end>
Gzip on;
# News2 start --
Gzip_min_length 1 K;
Gzip_buffers 4 16 K;
Gzip_http_version 1.1;
Gzip_comp_level 2;
Gzip_types text/plain application/X-JavaScript text/CSS application/XML;
Gzip_vary on;
Upstream tomcat_server {
Server 192.168.0.29: 8035;
Server 192.168.0.27: 8090;
}
Server {
Listen 8088;
SERVER_NAME 192.168.0.104;
Charset UTF-8;
Location /{
Proxy_pass http: // tomcat_server;
}
}
Server {
Listen 8620;
SERVER_NAME 192.168.0.104;
Location /{
Root/share;
Index index.html index.htm;
}
Error_page 500 502 503 x.html;
Location =/50x.html {
Root HTML;
}
}
}
Tomcat:
<Server port = "8025" shutdown = "shutdown">
<Listener classname = "org. Apache. Catalina. Core. aprlifecyclelistener"/>
<Listener classname = "org. Apache. Catalina. mbeans. serverlifecyclelistener"/>
<Listener classname = "org. Apache. Catalina. mbeans. globalresourceslifecyclelistener"/>
<Listener classname = "org. Apache. Catalina. storeconfig. storeconfiglifecyclelistener"/>
<Globalnamingresources>
<Environment name = "simplevalue" type = "Java. Lang. Integer" value = "30"/>
<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">
<Connector Port = "8035" maxhttpheadersize = "8192"
Maxthreads = "150" minsparethreads = "25" maxsparethreads = "75"
Enablelookups = "false" redirectport = "8045" acceptcount = "100"
Connectiontimeout = "20000" disableuploadtimeout = "true" uriencoding = "UTF-8"/>
<Connection Port = "8009"
Enablelookups = "false" redirectport = "8045" protocol = "AJP/1.3" uriencoding = "UTF-8"/>
<Engine name = "Catalina" defaulthost = "localhost" jvmroute = "A">
<Realm classname = "org. Apache. Catalina. realm. userdatabaserealm"
Resourcename = "userdatabase"/>
<Host name = "localhost" appbase = "webapps"
Unpackwars = "true" autodeploy = "true"
Xmlvalidation = "false" xmlnamespaceaware = "false">
<Context Path = "" docbase = "D: \ project \ test" DEBUG = "0"/>
</Host>
</Engine>
</Service>
</Server>