当前位置: 首页 > article >正文

配置清晰,nignx http tcp 代理 已经websocket

 启动

docker run -it --name lv_ocr --privileged=true --restart=always --net=host -v $(pwd)/config/nginx.conf:/etc/nginx/nginx.conf -v $(pwd)/config/conf.d:/etc/nginx/conf.d  -d  harbor.jettech.com/jettechtools/nginx:1.21.4

[root@it4it-prd-99 config]# ls
conf.d  nginx.conf
[root@it4it-prd-99 config]# tree
.
├── conf.d
│   ├── http
│   │   ├── server
│   │   │   ├── captcha_aarch64.conf
│   │   │   └── captcha_x86.conf
│   │   └── stream
│   │       ├── captcha_aarch64.conf
│   │       └── captcha_x86_64.conf
│   └── tcp
│       ├── server
│       │   └── mysql.conf
│       └── stream
│           └── mysql.conf
└── nginx.conf

[root@it4it-prd-99 config]# cat nginx.conf 
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
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  /var/log/nginx/access.log  main;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    include /etc/nginx/conf.d/http/stream/*.conf;
    include /etc/nginx/conf.d/http/server/*.conf;
}
stream {
    include /etc/nginx/conf.d/tcp/stream/*.conf;
    include /etc/nginx/conf.d/tcp/server/*.conf;
}

 http: 

[root@it4it-prd-99 config]# cat conf.d/http/server/captcha_x86.conf 
server {
    listen 80;
    location / {
       proxy_set_header X-Forwarded-Host $host;
       proxy_set_header Host $host;
       proxy_set_header X-Forwarded-Server $host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       client_max_body_size 3000m;
       proxy_buffer_size 63k;
       proxy_buffers   1024 64k;
       client_body_buffer_size 512m;
       fastcgi_connect_timeout 300;
       fastcgi_send_timeout 300;
       fastcgi_read_timeout 300;
       proxy_pass http://captcha_x86;
    }
    location /status {
            stub_status on;
            access_log off;
    }

}

 

[root@it4it-prd-99 config]# cat conf.d/http/stream/captcha_x86_64.conf 
upstream captcha_x86 {
     least_conn; #使用最少连接调度算法
     #ip_hash;
     #random;
     server 192.168.0.7:52000  weight=1 max_fails=5 fail_timeout=2;
     #server 192.168.0.8:9999  weight=1 max_fails=5 fail_timeout=2 backup; #备份机使用,所有宕机时候使用
}

tcp:

[root@it4it-prd-99 config]# cat conf.d/tcp/server/mysql.conf 
server {
    listen 23306;
    proxy_connect_timeout 10s;
    proxy_timeout 200s;
    proxy_pass mysql;
}

[root@it4it-prd-99 config]# cat conf.d/tcp/stream/mysql.conf 
upstream mysql {
    server 172.16.10.57:53306;
}


http://www.kler.cn/a/442540.html

相关文章:

  • java集合面试题
  • (三)html2canvas将HTML 转为图片并实现下载
  • mysql-5.7.18保姆级详细安装教程
  • 计算机视觉与深度学习:使用深度学习训练基于视觉的车辆检测器(MATLAB源码-Faster R-CNN)
  • 如何在 CentOS 中生成 CSR
  • linux删除用户
  • 计算机网络——期末复习(1)背诵
  • AI芯片常见概念
  • MoonBit 核心编译器正式开源!
  • 2.16、添加响应式数据
  • php面对对象的基础知识
  • 车载通信架构 --- 一个以太网帧包含多个DoIP帧?
  • 手机银行模拟器,一款高仿真银行app的模拟器,可以修改姓名 卡号 余额 做转账记录 做流水
  • 鸿蒙操作系统(HarmonyOS)的应用开发入门
  • Trimble天宝三维激光扫描仪在建筑工程竣工测量中的应用【沪敖3D】
  • 125. 耍杂技的牛 acwing 贪心算法
  • Redis 中的渐进式扩容
  • Elasticsearch-DSL高级查询操作
  • NoSQL大数据存储技术测试(6)图数据库Neo4J
  • C++入门小馆:初识sort函数
  • spring学习(spring-bean实例化(实现FactoryBean规范)(延迟实例化bean))
  • java error(2)保存时间带时分秒,回显时分秒变成00:00:00
  • shared_ptr 智能指针
  • HDFS常用命令
  • IIS服务器部署C# WebApi程序,客户端PUT,DELETE请求无法执行
  • vue3 + ts + element-plus 表格中的input按回车聚焦到下一行