Skip to content

A Nginx configuration parser that exports finded hosts into the hosts or dnsmasq format.

License

Notifications You must be signed in to change notification settings

sarkian/nginxhosts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NginxHosts

A Nginx configuration parser that exports finded hosts into the hosts or dnsmasq format.

usage: nginxhosts [-h] [-c CONFIG_FILES [CONFIG_FILES ...]] [-d CONFIG_DIR] [-a DEFAULT_ADDR] [-l] [-e EXCLUDED_HOSTS]
                     [-f {hosts,dnsmasq}]

A Nginx configuration parser that exports finded hosts into the hosts or dnsmasq format

optional arguments:
  -h, --help                                                show this help message and exit
  -c CONFIG_FILES [CONFIG_FILES ...], --config-files CONFIG_FILES [CONFIG_FILES ...]
                                                            nginx configuration file(s) (default: /etc/nginx/nginx.conf)
  -d CONFIG_DIR, --config-dir CONFIG_DIR                    nginx configuration directory (default: /etc/nginx)
  -a DEFAULT_ADDR, --default-addr DEFAULT_ADDR              default address (default: 127.0.0.1)
  -l, --use-listen                                          use address from 'listen' directive
  -e EXCLUDED_HOSTS, --excluded-hosts EXCLUDED_HOSTS        exclude hostnames, comma-separated (default: none)
  -f {hosts,dnsmasq}, --format {hosts,dnsmasq}              output format (default: hosts)

Installation

Python 2:

pip install nginxhosts

Python 3:

pip3 install nginxhosts

Examples

nginxhosts -e localhost,`hostname` >> /etc/hosts
nginxhosts -f dnsmasq > /etc/NetworkManager/dnsmasq.d/hosts.conf
nginxhosts -c /etc/nginx/sites-enabled/*

About

A Nginx configuration parser that exports finded hosts into the hosts or dnsmasq format.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages