配置清晰,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;
}
相关推荐
悠悠1213819 分钟前
NLB WebSocket 连接问题排查与解决方案
websocket·网络协议·php
4***175443 分钟前
Spring Boot整合WebSocket
spring boot·后端·websocket
Macbethad2 小时前
基于WPF的Ethernet/IP主站程序技术方案
网络协议·tcp/ip·wpf
岁岁种桃花儿2 小时前
HTTPS 比 HTTP 安全的核心原因:加密与身份验证机制解析
安全·http·https
ganshenml2 小时前
【Web】证书(SSL/TLS)与域名之间的关系:完整、通俗、可落地的讲解
前端·网络协议·ssl
q***61413 小时前
Java实战:Spring Boot实现WebSocket实时通信
java·spring boot·websocket
xu_yule4 小时前
网络和Linux网络-5(应用层)HTTP协议(方法+报头+状态码)
linux·网络·网络协议·http
n***4434 小时前
Node.js HTTP模块详解:创建服务器、响应请求与客户端请求
服务器·http·node.js
YY&DS5 小时前
Qt 快速搭建局域网 HTTP 下载服务(兼容 IE/Chrome/Edge/Firefox)
chrome·qt·http
西幻凌云5 小时前
了解计算机网络的“物理根基”——物理层与数据链路层
网络·网络协议·计算机网络·数据链路层·物理层