HAProxy 高级功能
介绍 HAProxy 高级配置及实用案例
压缩功能
对响应给客户端的报文进行压缩,以节省网络带宽,但是会占用部分CPU性能
建议在后端服务器开启压缩功能,而非在HAProxy上开启压缩
注意:默认Ubuntu的包安装nginx开启压缩功能
配置选项
compression algo <algorithm> ... #启用http协议中的压缩机制,常用算法有gzip,deflate
#压缩算法<algorithm>支持下面类型:
identity #debug调试使用的压缩方式
gzip #常用的压缩方式,与各浏览器兼容较好
deflate #有些浏览器不支持
raw-deflate #新式的压缩方式
compression type <mime type> ... #要压缩的文件类型MIME
#示例:
compression algo gzip deflate
compression type compression type text/plain text/html text/css text/xml text/javascript application/javascript
配置示例
lis