首页 > 系统相关 >nginx upstream配置文件

nginx upstream配置文件

时间:2023-12-10 12:34:38浏览次数:32  
标签:set 配置文件 header server nginx proxy timeout upstream 10.12

1.upstream
使用upstream 指定服务器组进行负载均衡
user root;
worker_processes 20;

error_log logs/error;

pid logs/nginx.pid;


events {
        worker_connections 1024;
}
http {
        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;
        tcp_nopush on;
        tcp_nodelay on;
        include mime.types;
        default_type application/octet-stream;
        sendfile on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        client_max_body_size 50M;
       client_body_buffer_size 10m;
    send_timeout 75;
        proxy_buffering on;
    client_header_buffer_size 32k;
    large_client_header_buffers 8 32k;
        proxy_buffers 64 32k;
        proxy_connect_timeout 3600;
        proxy_read_timeout 3600;
        proxy_send_timeout 3600;
    proxy_set_header X-Different-Name                    "true";        
    proxy_set_header X-Frame-Options                    "ALLOWALL";
    proxy_set_header X-Request-Start                    "t=${msec}";        
    proxy_set_header X-Using-Nginx-Controller                    "true";
    #add_header X-Frame-Options ALLOWALL;
    #add_header X-Different-Name true;
    #add_header X-Request-Start t=${msec};
    #add_header X-Using-Nginx-Controller true; 
    upstream shuiwu-atf {
        server 10.12.60.35:30007;
        server 10.12.60.38:30007;
        server 10.12.60.39:30007;
        server 10.12.60.40:30007;
        server 10.12.60.41:30007;
    }
    upstream shuiwu-base {
        server 10.12.60.35:30003;
        server 10.12.60.38:30003;
        server 10.12.60.39:30003;
        server 10.12.60.40:30003;
        server 10.12.60.41:30003;
    }
    upstream shuiwu-dm {
        server 10.12.60.35:30004;
        server 10.12.60.38:30004;
        server 10.12.60.39:30004;
        server 10.12.60.40:30004;
        server 10.12.60.41:30004;
    }
    upstream shuiwu-eit {
        server 10.12.60.35:30005;
        server 10.12.60.38:30005;
        server 10.12.60.39:30005;
        server 10.12.60.40:30005;
        server 10.12.60.41:30005;
    }
    upstream shuiwu-mis {
        server 10.12.60.35:30010;
        server 10.12.60.38:30010;
        server 10.12.60.39:30010;
        server 10.12.60.40:30010;
        server 10.12.60.41:30010;
    }
    upstream shuiwu-ints {
        server 10.12.60.35:30016;
        server 10.12.60.38:30016;
        server 10.12.60.39:30016;
        server 10.12.60.40:30016;
        server 10.12.60.41:30016;
    }
    upstream shuiwu-tda {
        server 10.12.60.35:30011;
        server 10.12.60.38:30011;
        server 10.12.60.39:30011;
        server 10.12.60.40:30011;
        server 10.12.60.41:30011;
    }
    upstream shuiwu-tom {
        server 10.12.60.35:30015;
        server 10.12.60.38:30015;
        server 10.12.60.39:30015;
        server 10.12.60.40:30015;
        server 10.12.60.41:30015;
    }
    upstream shuiwu-tra {
        server 10.12.60.35:30012;
        server 10.12.60.38:30012;
        server 10.12.60.39:30012;
        server 10.12.60.40:30012;
        server 10.12.60.41:30012;
    }
    upstream shuiwu-vatrep {
        server 10.12.60.35:30006;
        server 10.12.60.38:30006;
        server 10.12.60.39:30006;
        server 10.12.60.40:30006;
        server 10.12.60.41:30006;
    }
    upstream shuiwu-xxljob {
        server 10.12.60.35:30009;
        server 10.12.60.38:30009;
        server 10.12.60.39:30009;
        server 10.12.60.40:30009;
        server 10.12.60.41:30009;
    }
    upstream shuiwu-rpt {
        server 10.12.60.35:30008;
        server 10.12.60.38:30008;
        server 10.12.60.39:30008;
        server 10.12.60.40:30008;
        server 10.12.60.41:30008;
    }

        server{
                listen 443  ssl;
                server_name localhost;
                ssl_certificate      /data/nginx/conf/cert/goldwind.com.crt; # 修改为上面生成的服务器证书路径
                ssl_certificate_key  /data/nginx/conf/cert/goldwind.com.key; # 修改为上面生成的私钥路径
                location /ATF/ {
                        proxy_pass http://shuiwu-atf/ATF/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }
                location /BASE/ {
                        proxy_pass http://shuiwu-base/BASE/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }
                location /DM/ {
                        proxy_pass http://shuiwu-dm/DM/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }
                location /EIT/ {
                        proxy_pass http://shuiwu-eit/EIT/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }
                location /MIS/ {
                        proxy_pass http://shuiwu-mis/MIS/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }
                location /INTS/ {
                        proxy_pass http://shuiwu-ints/INTS/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }
                location /TDA/ {
                        proxy_pass http://shuiwu-tda/TDA/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }
                location /TOM/ {
                        proxy_pass http://shuiwu-tom/TOM/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }
                location /TRA/ {
                        proxy_pass http://shuiwu-tra/TRA/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }
                location /VATREP/ {
                        proxy_pass http://shuiwu-vatrep/VATREP/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }
                location /xxl-job-admin/ {
                        proxy_pass http://shuiwu-xxljob/xxl-job-admin/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }
                location /rpt/ {
                        proxy_pass http://shuiwu-rpt/rpt/;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real_IP $remote_addr;
                        proxy_set_header X-Fowarded-For $proxy_add_x_forwarded_for;
                        proxy_connect_timeout 600s;
                        proxy_read_timeout 600s;
                        proxy_send_timeout 600s;
                }


        }

}

 

标签:set,配置文件,header,server,nginx,proxy,timeout,upstream,10.12
From: https://www.cnblogs.com/xiaoxiaomuyuyu/p/17892387.html

相关文章

  • 安装与使用nginx
    编译安装nginx一、从官网下载nginx软件包(https://nginx.org/en/download.html) 将从官网下载的安装包添加到opt目录下 二、安装依赖包为编译安装做准备 三、将nginx安装包解压,并移动到nginx文件夹中 四、为nginx新建一个用户,便于管理 #设置该用户不可以登录并不建立......
  • nginx代理knife4j接口文档
    nginx配置(11215是服务的端口信息)location~*^(/v2|/swagger-resources|/swagger-ui|/swagger-ui/index.html|/webjars/|/favicon.ico/|/doc.html){ proxy_redirectoff; proxy_set_headerX-Real-IP$remote_addr; proxy_set_headerX-Forwarded-For$proxy_add_x_fo......
  • nginx启用身份安全认证
    修改Nginx配置文件 server{listen80;server_nameexample.com;#替换成自己的域名或IP地址location/{proxy_passhttp://localhost:18080;#将请求转发到SkyWalking服务器auth_basic"Restricted";#启用基本身份验证,显示提示信息auth_basic_user_file/etc......
  • Spring Boot学习随笔- @SpringBootApplication详解、加载绝对路径配置文件、工厂创建
    学习视频:【编程不良人】2021年SpringBoot最新最全教程3.5@SpringBootApplication详解这是一个组合注解,就是由多个注解组成。下列注解红框内称为元注解(jdk提供)@Target:指定注解作用范围@Retention:指定注解什么时候生效重要注解@SpringBootConfiguration:自动配置Spring......
  • 内核维护者手册 - 维护者入口配置文件【ChatGPT】
    https://www.kernel.org/doc/html/v6.6/maintainer/maintainer-entry-profile.html维护者入口配置文件维护者入口配置文件是对顶层流程文档(提交补丁、提交驱动程序等)的补充,其中包括子系统/设备驱动程序本地习俗以及有关补丁提交生命周期的详细信息。贡献者使用此文档来调整他......
  • bochsrc配置文件
    Orange'S一个操作系统的实现,原书第二版。ubuntu22.04环境下。第二章Bochs的使用,关于bochsrc配置文件,更新为下列代码,修改了第9,10行和第27行。################################################################ConfigurationfileforBochs##############################......
  • scrapy框架之配置文件1
    部分配置文件详解:1#-*-coding:utf-8-*-23#Scrapysettingsfortest001project4#5#Forsimplicity,thisfilecontainsonlysettingsconsideredimportantor6#commonlyused.Youcanfindmoresettingsconsultingthedocumentation:7......
  • scrapy框架之配置文件2
    ①自动限速算法1"""217.自动限速算法3fromscrapy.contrib.throttleimportAutoThrottle4自动限速设置51.获取最小延迟DOWNLOAD_DELAY62.获取最大延迟AUTOTHROTTLE_MAX_DELAY73.设置初始下载延迟AUTOTHROTTLE_START_DELAY8......
  • Ubuntu安装PHP和NGINX环境
    Ubuntu安装PHP和NGINX环境介绍PHP-FPMPHP-FPM是PHPFastCGIProcessManager的缩写,是FastCGI进程管理器。PHP-FPM是基于master/worker的多进程架构模式,与nginx的设计风格类似。master进程主要负责CGI、PHP环境初始化,事件监听、子进程状态,worker进程负责处理PHP......
  • Windows服务器,通过Nginx部署VUE+Django前后端分离项目
    目录基本说明安装Nginx部署VUE前端部署Django后端Djangoadmin静态文件(CSS,JS等)丢失的问题1.基本说明本文介绍了在windows服务器下,通过Nginx部署VUE+Django前后端分离项目。本项目前端运行在80端口,服务器端运行在8000端口。因此本项目使用Django的......