首页 > 其他分享 >011websocket代理

011websocket代理

时间:2023-01-03 12:23:36浏览次数:66  
标签:haproxy errors http ssl 代理 etc websocket 011websocket

一、安装haproxy

sudo add-apt-repository ppa:vbernat/haproxy-2.6 -y
sudo apt install haproxy -y
sudo systemctl status haproxy
sudo systemctl enable haproxy
cd /etc/haproxy
cp haproxy.cfg{,.20221229_140724}
vim haproxy.cfg && sudo systemctl restart haproxy

二、haproxy配置

global
	log /dev/log	local0
	log /dev/log	local1 notice
	chroot /var/lib/haproxy
	stats socket /run/haproxy/admin.sock mode 660 level admin
	stats timeout 30s
	user haproxy
	group haproxy
	daemon

	# Default SSL material locations
	ca-base /etc/ssl/certs
	crt-base /etc/ssl/private

	# See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate
        ssl-default-bind-ciphers xxx
        ssl-default-bind-ciphersuites xx
        ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets

defaults
	log	global
	mode	http
	option	httplog
	option	dontlognull
        #timeout connect 5000
        #timeout client  50000
        #timeout server  50000
        timeout tunnel 24h
        timeout client-fin 30s
	errorfile 400 /etc/haproxy/errors/400.http
	errorfile 403 /etc/haproxy/errors/403.http
	errorfile 408 /etc/haproxy/errors/408.http
	errorfile 500 /etc/haproxy/errors/500.http
	errorfile 502 /etc/haproxy/errors/502.http
	errorfile 503 /etc/haproxy/errors/503.http
	errorfile 504 /etc/haproxy/errors/504.http
frontend front_websocket
        bind *:23651
        mode http
        ## routing based on websocket protocol header
        acl hdr_connection_upgrade hdr(Connection)  -i upgrade
        acl hdr_upgrade_websocket  hdr(Upgrade)     -i websocket
        use_backend back_websocket if hdr_connection_upgrade hdr_upgrade_websocket

backend back_websocket
        balance roundrobin
        cookie SERVERID
        server host1 x.x.5.8:23651 cookie host1 maxconn 50000 check inter 10s rise 3 fall 3s

三、测试

http://www.easyswoole.com/wstool.html

 

 

reference: https://segmentfault.com/a/1190000042773675 

标签:haproxy,errors,http,ssl,代理,etc,websocket,011websocket
From: https://www.cnblogs.com/itcomputer/p/17021692.html

相关文章

  • Spring AOP源码(四):创建被代理类的代理对象
    在AOP源码(三):创建AOP相关的Bean中,介绍了Spring创建AOP的Advisor、AnnotationAwareAspectJAutoProxyCreator的创建,其中被代理类的代理对象是如何创建的未做说明,下面来......
  • Java中动态代理技术生成的类与原始类的区别 (good)
    用动态代理的时候,对它新生成的类长什么样子感到好奇.有幸通过一些资料消除了心里的疑惑.平时工作使用的Spring框架里面有一个AOP(面向切面)的机制,只知道它是把类......
  • 动态代理
    动态代理1.什么是代理模式代理模式是一种设计模式,就是通过代理对象操作原对象并且给原对象添加一些额外功能。代理模式分为静态代理和动态代理两种2.静态代理静态代......
  • Nginx 代理webSocket时60s自动断开, 保持长连接
    利用nginx代理websocket的时候,发现客户端和服务器握手成功后,如果在60s时间内没有数据交互,连接就会自动断开,如下图:为了保持长连接,可以采取来两种方式.1.nginx.conf文件里locati......
  • Nginx 代理websocket连接上限
    一.结论 1.nginx最多只能维持(65535*后端服务器IP个数)条websocket的长连接,如果后端websocket服务器IP只有一个,那么就只能最多支持65535条连接。瓶颈就产生在了nginx上......
  • 在Ubuntu上安装Azure DevOps代理程序
    Contents1概述2.安装Ubuntu18.04操作系统3.安装AzureDevOpsServer代理3.1安装AzureDevOpsServer代理3.2以服务方式运行代理1.概述Ubuntu是一个以桌面应用为主......
  • 网络代理
    正向代理正向代理模式如上图所示,客户端发送网络请求到代理服务器,代理服务器发送请求到相应服务端,并且服务端返回的数据先经过代理服务器,再由代理服务器发送给客户端。在......
  • node.js编写反向代理转发https
    node.js编写反向代理转发httpsconstcrypto=require("crypto");constmd5=function(str){constmd5=crypto.createHash('md5');md5.update(str);......
  • 正向代理与反向代理
    概要:正向代理与反向代理的简述和区别......简述:一、代理的概念:类似于一个中介,在A和B的连接中间使用C作为中介,C就是一个代理,用于A,B直接连接的中间处理或是资源分配。二......
  • docker pull设置代理
    由于网络限制,一些服务器通常需要使用代理才能连接外网.1.在服务器上添加如下目录mkdir/etc/systemd/system/docker.service.d2.创建如下文件,并配置你的代理服务器vi......