Skip to content

JoyChou93/nginxparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nginxparser

功能

用python解析nginx配置,获取server块以及server块每个location的后端ip。

安装

wget https://raw.githubusercontent.com/JoyChou93/nginxparser/master/nginx.py

使用

调用代码

from nginx import NGINX nginx = NGINX('nginx.conf') print(nginx.servers) 

结果

[{	'include': 'fastcgi_params',	'backend': [],	'port': '80',	'server_name': 'localhost' }, {	'include': '',	'backend': [{	'backend_path': '/test',	'backend_ip': '10.10.10.10:8080 10.10.10.11:8080'	}],	'port': '81',	'server_name': 'test.baidu.com' }] 

About

use python to parse nginx

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages