nginx的loadbalancer conf文件解析python

时间:2018-12-29 10:15:14

标签: python file nginx split config

我有一个像这样的nginx conf文件:

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,;

或者如果您有其他建议,我会很乐意听。

我想将所有配置发送到网页表单输入,但是我没有拆分配置。

0 个答案:

没有答案
相关问题