python - nginx loadbalancer conf文件解析python
问题描述
我有一个像这样的 nginx 配置文件:
upstream server1.stack.com {
zone server1.stack.com 2048k;
#least_time header;
least_conn;
keepalive 256;
server 10.10.12.141:3311 max_fails=0 slow_start=10s;
server 10.10.12.141:33311 max_fails=0 slow_start=10s;
}
server {
listen 10.11.128.194:80 backlog=102400 reuseport;
server_name server1.stack.com;
status_zone server1.stack.com;
location / {
proxy_pass http://server1.stack.com;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection "";
#health_check;
}
location @hc {
proxy_pass http://server1.stack.com;
proxy_set_header Host server1.stack.com;
proxy_http_version 1.1;
proxy_set_header Connection "";
health_check uri=/status interval=3 fails=2 passes=2;
error_log /var/log/nginx/error_hc.log info;
}
}
我想像这样解析这个文件:
server1.stack.com = {'zone':['server1.stack.com','2048k',';'],'#least_time':['header',';'],'least_conn':[';']'live':['256',';'],'server':['10.10.12.141:3311','max_fails=0','slow_start=10s',';']}...
键:区域值:server1.stack.com, 2048, ;
或者如果你有不同的建议,我很乐意倾听。
我想将所有配置发送到网页表单输入但我没有拆分配置。
解决方案
推荐阅读
- angular - NGiNX - 没有为错误返回足够的标头(4xx,5xx)与成功(2xx)
- android - 获取安卓设备存储容量
- wolfram-mathematica - 如何在 Mathematica 中将列向量乘以行向量?
- cassandra - Kubernetes:在 GCP 上部署 Cassandra(有状态集)
- excel - VBA - 如何动态访问用户表单
- android-studio - 第一个颤振应用程序(Android Studio)的问题
- dart - Flutter 架构问题/回调函数
- excel - Excel像素与点不成比例
- java - 使用“volatile”之前发生的关系不能按预期工作
- algorithm - 具有 2 个唯一数字的最大连续子数组的长度