首页 > 系统相关 >nginx的upstream配置backup和check方法

nginx的upstream配置backup和check方法

时间:2022-11-01 11:37:22浏览次数:41  
标签:set http log header nginx proxy timeout upstream backup

server {
    listen                  80;
    server_name             ocean.xxxx;
    access_log              /app/tengine_log/logs/ocean.xxxx.gelk.access.log intranethttps;    # 校验此日志格式是否在主配置文件里存在
    error_log               /app/tengine_log/logs/ocean.xxxx.gelk.error.log error;
    
    proxy_set_header        Host                $host;
    proxy_set_header        X-Real-IP           $remote_addr;
    proxy_set_header        X-Forwarded-For     $proxy_add_x_forwarded_for;

    location    / {
                  proxy_headers_hash_max_size 51200;
                   proxy_headers_hash_bucket_size 6400;
                   proxy_set_header X-Real-IP $remote_addr;
                   proxy_set_header X-Forwarded-For $remote_addr;
                   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                   proxy_set_header Host $host;
                   proxy_connect_timeout 180;
                   proxy_read_timeout 180;
                   proxy_send_timeout 180;
                   proxy_redirect off;
                   proxy_pass http://ocean.live.cn;
    }

}

upstream ocean.live.cn {
    # None
    server 192.168.1.8:8081 max_fails=3 fail_timeout=10 weight=1;
    server 192.168.1.8:8081 max_fails=3 fail_timeout=10 weight=1 backup;
    check interval=3000 rise=2 fall=3 timeout=2000 type=http;
    check_http_send "GET /xxxx/config/status HTTP/1.1\r\nHost: \r\n\r\n";
    check_http_expect_alive http_2xx http_3xx;
}

标签:set,http,log,header,nginx,proxy,timeout,upstream,backup
From: https://www.cnblogs.com/hsjz-xinyuan/p/16847086.html

相关文章

  • nginx高并发优化之系统内核参数优化
    一、内核参数优化设置vi/etc/sysctl.conffs.file-max=655360net.ipv4.ip_forward=0net.ipv4.conf.default.rp_filter=1net.ipv4.conf.default.accept_source_route=......
  • 使用Docker一键搭建FastDFS+Nginx分布式文件服务器
    做过很多项目在图片上传上一直使用的是FastDFS,刚开始得知搭建一个这样的系统非常复杂,所以直接使用了淘淘商城的虚拟机。在后面的项目中,最终选择在在阿里云上自己搭建一个Fas......
  • nginx中的proxy_pass配置
    Nginx是最常用的反向代理工具之一,一个指令proxy_pass搞定反向代理,对于接口代理、负载均衡很是实用,但proxy_pass指令后面的参数很有讲究,通常一个/都可能引发一个血案。......
  • Linxu下如何查看一个服务/应用的所在位置和配置位置(以nginx为例)
    有时候我们需要查看某个程序的配置和运行目录以nginx为例1、看出进程ID -PID [root@www~]#ps-CnginxPIDTTYTIMECMD1113?00:00:00n......
  • 关于nginx 一个服务器,多个站点的困惑?
    比如在nginx的html文件夹中,存在两个目录web1和web2http://xxxxx/web1http://xxxxx/web2如果使用localStorage来存储token,就会出现两个网站共享localStorage的情......
  • 配置Nginx遇到Active:inactive (dead)解决方法
    问题:●nginx.service-nginx-highperformancewebserverLoaded:loaded(/lib/systemd/system/nginx.service;enabled;vendorpreset:enabled)Acti......
  • Nginx配置godaddy证书
    在阿里云上购买的证书下载直接上传服务器配置到Nginx就可以直接使用,但是godaddy的需要自己手动生成证书:1.在网站:https://www.myssl.cn/tools/create-csr.html上生成KEY及......
  • Nginx学习六:静态代理
    文章目录​​一、原因​​​​二、原理图​​​​三、Nginx静态代理实现方式​​​​方式一:在nginx.conf的location中配置静态资源的后缀​​​​方式二在nginx.conf的lo......
  • nginx容器与php-fpm容器连接方式
    文档说明:只记录关键地方;获得nginx和php基础镜像的内默认配置文件从容器镜像中拷贝文件到容器外#!/bin/bashset-eux__DIR__=$(cd"$(dirname"$0")"pwd)c......
  • nginx load balance
    loadbalancehttps://zhuanlan.zhihu.com/p/64777456 四层负载均衡(tcp)在三层负载均衡的基础上,用ip+port接收请求,再转发到对应的机器。七层负载均衡(http)根据虚拟......