#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 32k;
large_client_header_buffers 4 32K;
client_max_body_size 8m;
#new 1 end -----------
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#tomcat add start<<
tcp_nodelay on;
client_body_buffer_size 512k;
proxy_connect_timeout 5;
proxy_read_timeout 60;
proxy_send_timeout 5;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
#tomcat add end>>
gzip on;
#news2 start --
gzip_min_length 1k;
gzip_buffers 4 16k;
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">
多Server
#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 32k;
large_client_header_buffers 4 32K;
client_max_body_size 8m;
#new 1 end -----------
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#tomcat add start<<
tcp_nodelay on;
client_body_buffer_size 512k;
proxy_connect_timeout 5;
proxy_read_timeout 60;
proxy_send_timeout 5;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
#tomcat add end>>
gzip on;
#news2 start --
gzip_min_length 1k;
gzip_buffers 4 16k;
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 504 /50x.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" />
<Connector 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>
相关推荐
Linux(CentOS8) Nginx配置TCP负载均衡
CentOS系统安装配置Nginx+keepalived实现负载均衡
nginx+redis负载均衡、session共享,基于redis+tomcat实现session同步的简单demo
在centos系统中安装nginx及依赖包。 配置nginx反向代理及负载均衡。
CentOS Linux安装配置nginx以及样例.
主要介绍了CentOS6.5环境安装nginx服务器及负载均衡配置操作,结合实例形式较为详细的分析了CentOS6.5环境安装nginx服务器及负载均衡配置具体步骤、命令与相关问题解决方法,需要的朋友可以参考下
centos6.5下安装配置Nginx,实现负载均衡,IIS服务器;centos6.5下安装配置Nginx,实现负载均衡,IIS服务器
CentOS7下Nginx+Tomcat负载均衡及Redis共享Session解决方案
Linux Centos7中搭建Nginx负载均衡,里面包含了详细文档(ps:有详细的操作步骤哟),还有相关的安装包以及测试包
nginx作为一款服务器,在反向代理、负载均衡等方面具有优秀的性能,但是在深入学习之前需要先安装nginx。这里记录一下自己在centos7操作系统下安装nginx的过程,以便之后学习时查阅。笔者这里的Linux服务器使用的是...
能够实现负载均衡。 负载均衡(Load Balance)指的是将请求/数据(均匀)分摊到多个服务器上去执行,其核心是均衡的分摊压力。 此nginx资源文档包括nginx在centos7上的详细配置,以及nginx分布式部署; 也就是通过部署多...
本文实例讲述了CentOS基于nginx反向代理实现负载均衡的方法。分享给大家供大家参考,具体如下: nginx做负载均衡的优点: 1、工作在网络的7层之上,可以针对http应用做一些分流的策略,比如针对域名、目录结构,它的...
centos7.6离线安装nginx
13-CentOS7-搭建Nginx代理服务(负载均衡),nginx 实现动静分离的方法;php-fpm 模块调用本机的 php 环境;将请求交给其 他 lamp。
nginx.conf nginx-1.20.1.tar.gz 这是关于centos8的nginx 和nginx 的配置https文件
centos源码安装nginx-1.20.2+nginx负载均衡
Centos6.2上做nginx和tomcat的集成及负载均衡
CentOS6.8 安装 Nginx 配置负载CentOS6.8 安装 Nginx 配置负载
centos6.4安装nginx+keepalived实现高可用负载均衡.doc