Skip to main content

Python library for generating nginx reverse proxy configurations for Docker applications.

Project description

Nginx-set-conf

====================================================================================
This is a simple python library that helps you to create configurations for different docker based applications with nginx as reverse proxy.

Installation

Nginx-set-conf requires

  • Python (>= 3.8)
  • click (>= 8.1.3)
  • PyYaml (>= 5.4.1)

Use the package manager pip to install nginx-set-conf.

pip install nginx-set-conf

Usage

$ nginx-set-conf --help
usage: nginx-set-conf [--help] [--config_template] [--ip] [--domain] [--port] [--cert_name] [--pollport] [--redirect_domain] [--auth_file] [--config_path] [--target_path] [--dry_run]
Options:
  --config_template TEXT  Insert the conf-template.  
  --show_template        Show the template configuration without applying it
  
                          We support:
                          - ngx_code_server (code-server with ssl)
                          - ngx_fast_report (FastReport with ssl)
                          - ngx_kasm (Kasm Workspaces with ssl/http2)
                          - ngx_mailpit (Mailpit with ssl/http2)
                          - ngx_n8n (n8n with ssl/http2)
                          - ngx_nextcloud (NextCloud with ssl)
                          - ngx_odoo_http (Odoo only http)
                          - ngx_odoo_ssl (Odoo with ssl)
                          - ngx_pgadmin (pgAdmin4 with ssl)
                          - ngx_portainer (Portainer with ssl)
                          - ngx_pwa (Progressive Web App with ssl)
                          - ngx_qdrant (Qdrant vector database with ssl/http2 and gRPC support)
                          - ngx_redirect (Redirect Domain without ssl)
                          - ngx_redirect_ssl (Redirect Domain with ssl)
                          - ngx_supabase (Supabase database server with ssl/http2)
  --ip TEXT               IP address of the server
  --domain TEXT           Name of the domain
  --port TEXT             Primary port for the Docker container
  --cert_name TEXT        Name of certificate if you want to use letsencrypt - complete path for self signed or purchased certificates
  --cert_key TEXT         Name and path of certificate key - for self signed or purchased certificates - leave empty for letsencrypt
  --pollport TEXT         Secondary Docker container port for odoo pollings
  --grpcport TEXT         Secondary Docker container port for gRPC services (used by Qdrant)
  --redirect_domain TEXT  Redirect domain
  --auth_file TEXT        Use authfile for htAccess 
  --config_path TEXT      Yaml configuration folder
  --target_path TEXT      Target path where the configuration files will be saved (default: /etc/nginx/conf.d)
  --dry_run               Run configuration generation without applying changes or creating certificates
  --help                  Show this message and exit.

Example

# Execution with config file
nginx-set-conf --config_path server_config

f.e.

nginx-set-conf --config_path=$HOME/docker-builds/ngx-conf

Execution without config file

nginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.equitania.de --port 8069 --cert_name www.equitania.de --pollport 8072

Using custom target path

nginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.equitania.de --port 8069 --cert_name www.equitania.de --target_path /tmp/nginx-test

Dry run mode

nginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.equitania.de --port 8069 --cert_name www.equitania.de --dry_run

Create your cert

certbot certonly --standalone --agree-tos --register-unsafely-without-email -d www.equitania.de

Install certbot on Debian/Ubuntu with

apt-get install certbot

Create your auth file

Install htpasswd on Debian/Ubuntu with

apt-get install apache2-utils
htpasswd -c /etc/nginx/.htaccess/.htpasswd-user USER

nginx template settings

You can download our settings: nginx.conf
and the : nginxconfig.io.zip
based on https://www.digitalocean.com/community/tools/nginx

This project is licensed under the terms of the AGPLv3 license.

# Show template configuration
nginx-set-conf --config_template ngx_odoo_ssl --show_template

# Show kasm template
nginx-set-conf --config_template ngx_kasm --show_template

# Test configuration without applying changes
nginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain example.com --port 8069 --cert_name example.com --dry_run

# Use custom target path for configuration files
nginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain example.com --port 8069 --cert_name example.com --target_path /tmp/nginx-configs

Qdrant Vector Database Example

# Qdrant with gRPC support
nginx-set-conf --config_template ngx_qdrant --ip 1.2.3.4 --domain vector.example.com --port 6333 --grpcport 6334 --cert_name vector.example.com

# Show qdrant template configuration
nginx-set-conf --config_template ngx_qdrant --show_template

Supabase Database Server Example

# Supabase database server
nginx-set-conf --config_template ngx_supabase --ip 1.2.3.4 --domain supabase.example.com --port 8000 --cert_name supabase.example.com

# Show supabase template configuration
nginx-set-conf --config_template ngx_supabase --show_template

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nginx_set_conf-1.3.9.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nginx_set_conf-1.3.9-py3-none-any.whl (46.8 kB view details)

Uploaded Python 3

File details

Details for the file nginx_set_conf-1.3.9.tar.gz.

File metadata

  • Download URL: nginx_set_conf-1.3.9.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nginx_set_conf-1.3.9.tar.gz
Algorithm Hash digest
SHA256 aed7e7b7eba5d3a3db03e2d61edd93ddf60f56a06f9b03033ae4f8d31a9fcc13
MD5 8a93933131ffc9ee50c55e01959f40e4
BLAKE2b-256 dd70a58ae4c9881369ee5aba383e487da7aab83a61edfeb2599e8b444732206e

See more details on using hashes here.

File details

Details for the file nginx_set_conf-1.3.9-py3-none-any.whl.

File metadata

  • Download URL: nginx_set_conf-1.3.9-py3-none-any.whl
  • Upload date:
  • Size: 46.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nginx_set_conf-1.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 6c8dd01bcf5efabe05d628044462d016ebea2cbb5eb76630ec0668ebdfc901b2
MD5 047bdc571e8e73770a2c508c45c07a4b
BLAKE2b-256 6ea8d7eaa49e1349a7745bf2fcdfed03c163d40b2bf3700957f2d620cb549518

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page