配置清晰,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;
}
相关推荐
努力成为DBA的小王2 小时前
Linux(网络协议和管理)
linux·运维·服务器·网络·网络协议
摸五休二2 小时前
链接定位技术解析:如何实现精准 GPS 定位与 IP 地址获取
网络·网络协议·tcp/ip
群联云防护小杜2 小时前
黑客如何找到App中的源IP:原理与防范
运维·服务器·前端·网络·网络协议·tcp/ip
SRestia3 小时前
Django+React---从0搭建一个听音乐+聊天室的网站
websocket·django·react
九州ip动态5 小时前
如何解决手机,电脑等工作室同ip关联问题
网络协议·tcp/ip·智能路由器
追光天使6 小时前
Win/Mac 如何实现测试 IP 和端口
网络·网络协议·tcp/ip
drebander6 小时前
HTTP 1.0 与 HTTP 2.0 的区别
网络·网络协议·http
如果可以,请简单点。7 小时前
SSL Version 2 and 3 Protocol Detection漏洞修复
网络·网络协议·ssl
你好骚啊7 小时前
宝塔SSL证书申请失败,报错:申请SSL证书错误 module ‘OpenSSL.crypto‘ has no attribute ‘sign‘(已解决)
服务器·网络协议·ssl