nginx-set-conf


Namenginx-set-conf JSON
Version 1.5.4 PyPI version JSON
download
home_pagehttps://github.com/equitania/nginx-set-conf
SummaryPython library for generating nginx reverse proxy configurations for Docker applications.
upload_time2025-07-28 15:31:04
maintainerNone
docs_urlNone
authorEquitania Software GmbH
requires_python>=3.10
licenseNone
keywords nginx configuration docker reverse-proxy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nginx-set-conf

[🇬🇧 English Version](#english-version) | [🇩🇪 Deutsche Version](#deutsche-version)

---

## 🇬🇧 English Version

A simple Python library that helps you create nginx configurations for different Docker-based applications with nginx as reverse proxy, including configuration verification features.

### Features

- **Template-based configuration**: Support for 15+ pre-built templates
- **SSL/TLS support**: Automatic Let's Encrypt integration
- **Configuration verification**: Check consistency between local and server files
- **Configuration verification**: Check if required nginx files exist
- **Backup functionality**: Automatic backup of server configurations
- **Dry run mode**: Test configurations without applying changes
- **PDF MIME-Type optimization**: Enhanced PDF handling for Odoo applications

### Installation

#### Requirements

- Python (>= 3.10)
- click (>= 8.2.1)
- PyYAML (>= 6.0.2)

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install nginx-set-conf:

```bash
pip install nginx-set-conf
```

### Usage

#### Basic Usage

```bash
$ nginx-set-conf --help
```

#### Supported Templates

- `ngx_code_server` - Code-server with SSL
- `ngx_fast_report` - FastReport with SSL
- `ngx_flowise` - Flowise AI with SSL/HTTP2
- `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 HTTP only
- `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
- `ngx_redirect` - Domain redirect without SSL
- `ngx_redirect_ssl` - Domain redirect with SSL
- `ngx_supabase` - Supabase database server with SSL/HTTP2

#### Configuration Management Options

- `--verify_config` - Check consistency between local and server config files
- `--create_dirs` - Create missing nginx configuration directories
- `--backup_config` - Create backup of current server configuration

### Examples

#### Basic Configuration

```bash
# Using configuration file
nginx-set-conf --config_path server_config

# Direct configuration
nginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --pollport 8072

# Custom target path
nginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --target_path /tmp/nginx-test

# Dry run mode
nginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --dry_run
```

#### Template Preview

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

# Show Qdrant template
nginx-set-conf --config_template ngx_qdrant --show_template
```

#### Advanced Examples

```bash
# 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

# Flowise AI server
nginx-set-conf --config_template ngx_flowise --ip 1.2.3.4 --domain flowise.example.com --port 3000 --cert_name flowise.example.com

# 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
```

### Configuration Verification

#### 1. Configuration File Check (`--verify_config`)

Check if required nginx configuration files exist on the server:

```bash
nginx-set-conf --verify_config
```

**Checked Files:**
- `/etc/nginx/nginx.conf`
- `/etc/nginx/nginxconfig.io/general.conf`
- `/etc/nginx/nginxconfig.io/security.conf`
- `/etc/nginx/nginxconfig.io/ssl_stapling.conf`

**Output:**
- ✓ EXISTS: File is present on the server
- ✗ MISSING: File not found
- Shows file path and size for existing files

#### 2. Create Missing Directories (`--create_dirs`)

Create missing nginx configuration directories if needed:

```bash
nginx-set-conf --create_dirs
```

**What it does:**
- Checks for missing files
- Creates `/etc/nginx/nginxconfig.io/` directory if missing
- Useful after fresh nginx installation

**Security Features:**
- Confirmation before overwriting files
- Automatic directory creation
- Error handling for access problems

#### 3. Configuration Backup (`--backup_config`)

Create automatic backups of current server configuration:

```bash
nginx-set-conf --backup_config
```

**Backup Features:**
- Timestamp-based backup folders: `/tmp/nginx_backup/nginx_config_backup_YYYYMMDD_HHMMSS`
- Complete backup of `/etc/nginx/nginx.conf`
- Recursive backup of `nginxconfig.io/` directory
- Logging of all backup operations

### Practical Usage Scenarios

#### Scenario 1: Consistency Check Before Deployment

```bash
# Check before deployment
nginx-set-conf --verify_config

# If inconsistencies found: Create backup
nginx-set-conf --backup_config

# If directories missing, create them
nginx-set-conf --create_dirs
```

#### Scenario 2: Server Setup Adoption

```bash
# Backup current server configuration
nginx-set-conf --backup_config

# Create missing directories if needed
nginx-set-conf --create_dirs

# Verify result
nginx-set-conf --verify_config
```

#### Scenario 3: Fresh nginx Installation

```bash
# Check if all required files exist
nginx-set-conf --verify_config

# If directories are missing, create them
nginx-set-conf --create_dirs
```

### SSL Certificate Management

#### Create Let's Encrypt Certificate

```bash
certbot certonly --standalone --agree-tos --register-unsafely-without-email -d www.example.com
```

#### Install certbot on Debian/Ubuntu

```bash
apt-get install certbot
```

#### Create Authentication File

```bash
# Install htpasswd on Debian/Ubuntu
apt-get install apache2-utils
htpasswd -c /etc/nginx/.htaccess/.htpasswd-user USER
```

### Nginx Template Settings

You can download our optimized settings:
- [nginx.conf](https://rm.ownerp.io/staff/nginx.conf)
- [nginxconfig.io.zip](https://rm.ownerp.io/staff/nginxconfig.io.zip)

Based on [https://www.digitalocean.com/community/tools/nginx](https://www.digitalocean.com/community/tools/nginx)

### Technical Details

#### Hash-based Verification
- SHA256 hashes for precise file comparisons
- Detection of content, size, and modification time
- Robust error handling for access problems

#### Secure Synchronization
- Explicit user confirmation before overwrites
- Automatic directory creation
- Detailed logging information
- Rollback possibility through backup system

#### Flexible Path Configuration
- Customizable local paths (default: `yaml_examples/`)
- Configurable server paths (default: `/etc/nginx/`)
- Support for different nginx installations

### Advanced Usage

#### Combined Commands
```bash
# Backup + Verification in one workflow
nginx-set-conf --backup_config && nginx-set-conf --verify_config
```

#### Combining with Other Options
```bash
# Verification with Dry-Run
nginx-set-conf --verify_config --dry_run
```

### Troubleshooting

#### Common Issues

1. **Permission denied**: Ensure user has write permissions for `/etc/nginx/`
2. **Missing directories**: Tool automatically creates missing directories
3. **Backup storage full**: Remove old backups from `/tmp/nginx_backup/`

#### Logging
All operations are logged to:
- Console: INFO level
- File: `nginx_set_conf.log` (with rotation)

### Security Aspects

- **No automatic changes**: All changes require explicit confirmation
- **Backup-first approach**: Backup recommended before configuration changes
- **Granular control**: Individual files can be identified and handled
- **Error handling**: Robust handling of permission and access problems

### License

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

---

## 🇩🇪 Deutsche Version

Eine einfache Python-Bibliothek, die bei der Erstellung von nginx-Konfigurationen für verschiedene Docker-basierte Anwendungen mit nginx als Reverse-Proxy hilft, einschließlich erweiterten Konfigurationsverifikations- und Synchronisationsfunktionen.

### Funktionen

- **Template-basierte Konfiguration**: Unterstützung für 15+ vorgefertigte Templates
- **SSL/TLS-Unterstützung**: Automatische Let's Encrypt Integration
- **Konfigurationsverifikation**: Konsistenzprüfung zwischen lokalen und Server-Dateien
- **Interaktive Synchronisation**: Synchronisation von Konfigurationen zwischen lokal und Server
- **Backup-Funktionalität**: Automatische Sicherung von Server-Konfigurationen
- **Dry-Run-Modus**: Konfigurationen testen ohne Änderungen anzuwenden
- **PDF MIME-Type-Optimierung**: Verbesserte PDF-Behandlung für Odoo-Anwendungen

### Installation

#### Anforderungen

- Python (>= 3.10)
- click (>= 8.2.1)
- PyYAML (>= 6.0.2)

Verwenden Sie den Paketmanager [pip](https://pip.pypa.io/en/stable/) zur Installation von nginx-set-conf:

```bash
pip install nginx-set-conf
```

### Verwendung

#### Grundlegende Verwendung

```bash
$ nginx-set-conf --help
```

#### Unterstützte Templates

- `ngx_code_server` - Code-Server mit SSL
- `ngx_fast_report` - FastReport mit SSL
- `ngx_flowise` - Flowise AI mit SSL/HTTP2
- `ngx_kasm` - Kasm Workspaces mit SSL/HTTP2
- `ngx_mailpit` - Mailpit mit SSL/HTTP2
- `ngx_n8n` - n8n mit SSL/HTTP2
- `ngx_nextcloud` - NextCloud mit SSL
- `ngx_odoo_http` - Odoo nur HTTP
- `ngx_odoo_ssl` - Odoo mit SSL
- `ngx_pgadmin` - pgAdmin4 mit SSL
- `ngx_portainer` - Portainer mit SSL
- `ngx_pwa` - Progressive Web App mit SSL
- `ngx_qdrant` - Qdrant Vektordatenbank mit SSL/HTTP2 und gRPC
- `ngx_redirect` - Domain-Weiterleitung ohne SSL
- `ngx_redirect_ssl` - Domain-Weiterleitung mit SSL
- `ngx_supabase` - Supabase Datenbankserver mit SSL/HTTP2

#### Konfigurationsverwaltungsoptionen

- `--verify_config` - Prüfen ob benötigte nginx Konfigurationsdateien existieren
- `--create_dirs` - Fehlende nginx Konfigurationsverzeichnisse erstellen
- `--backup_config` - Backup der aktuellen Server-Konfiguration erstellen

### Beispiele

#### Grundkonfiguration

```bash
# Verwendung von Konfigurationsdatei
nginx-set-conf --config_path server_config

# Direkte Konfiguration
nginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --pollport 8072

# Benutzerdefinierter Zielpfad
nginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --target_path /tmp/nginx-test

# Dry-Run-Modus
nginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --dry_run
```

#### Template-Vorschau

```bash
# Template-Konfiguration anzeigen
nginx-set-conf --config_template ngx_odoo_ssl --show_template

# Qdrant-Template anzeigen
nginx-set-conf --config_template ngx_qdrant --show_template
```

#### Erweiterte Beispiele

```bash
# Qdrant mit gRPC-Unterstützung
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

# Flowise AI Server
nginx-set-conf --config_template ngx_flowise --ip 1.2.3.4 --domain flowise.example.com --port 3000 --cert_name flowise.example.com

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

### Konfigurationsverifikation

#### 1. Konfigurationsdatei-Prüfung (`--verify_config`)

Prüfen ob benötigte nginx Konfigurationsdateien auf dem Server existieren:

```bash
nginx-set-conf --verify_config
```

**Geprüfte Dateien:**
- `/etc/nginx/nginx.conf`
- `/etc/nginx/nginxconfig.io/general.conf`
- `/etc/nginx/nginxconfig.io/security.conf`
- `/etc/nginx/nginxconfig.io/ssl_stapling.conf`

**Ausgabe:**
- ✓ EXISTS: Datei ist auf dem Server vorhanden
- ✗ MISSING: Datei nicht gefunden
- Zeigt Dateipfad und Größe für existierende Dateien

#### 2. Fehlende Verzeichnisse erstellen (`--create_dirs`)

Fehlende nginx Konfigurationsverzeichnisse bei Bedarf erstellen:

```bash
nginx-set-conf --create_dirs
```

**Was es tut:**
- Prüft auf fehlende Dateien
- Erstellt `/etc/nginx/nginxconfig.io/` Verzeichnis falls fehlend
- Nützlich nach frischer nginx Installation

#### 3. Konfigurationsbackup (`--backup_config`)

Automatische Backups der aktuellen Server-Konfiguration erstellen:

```bash
nginx-set-conf --backup_config
```

**Backup-Funktionen:**
- Zeitstempel-basierte Backup-Ordner: `/tmp/nginx_backup/nginx_config_backup_YYYYMMDD_HHMMSS`
- Vollständige Sicherung von `/etc/nginx/nginx.conf`
- Rekursive Sicherung des `nginxconfig.io/` Verzeichnisses
- Logging aller Backup-Operationen

### Praktische Anwendungsszenarien

#### Szenario 1: Konsistenzprüfung vor Deployment

```bash
# Vor dem Deployment prüfen
nginx-set-conf --verify_config

# Bei Inconsistenzen: Backup erstellen
nginx-set-conf --backup_config

# Bei fehlenden Verzeichnissen erstellen
nginx-set-conf --create_dirs
```

#### Szenario 2: Server-Setup übernehmen

```bash
# Aktuelle Server-Konfiguration sichern
nginx-set-conf --backup_config

# Fehlende Verzeichnisse erstellen falls nötig
nginx-set-conf --create_dirs
# Option 1 wählen: Local → Server

# Ergebnis überprüfen
nginx-set-conf --verify_config
```

#### Szenario 3: Neue nginx Installation prüfen

```bash
# Prüfen ob alle Dateien vorhanden sind
nginx-set-conf --verify_config

# Falls Verzeichnisse fehlen, diese erstellen
nginx-set-conf --create_dirs
```

### SSL-Zertifikatsverwaltung

#### Let's Encrypt Zertifikat erstellen

```bash
certbot certonly --standalone --agree-tos --register-unsafely-without-email -d www.example.com
```

#### certbot auf Debian/Ubuntu installieren

```bash
apt-get install certbot
```

#### Authentifizierungsdatei erstellen

```bash
# htpasswd auf Debian/Ubuntu installieren
apt-get install apache2-utils
htpasswd -c /etc/nginx/.htaccess/.htpasswd-user USER
```

### Nginx-Template-Einstellungen

Sie können unsere optimierten Einstellungen herunterladen:
- [nginx.conf](https://rm.ownerp.io/staff/nginx.conf)
- [nginxconfig.io.zip](https://rm.ownerp.io/staff/nginxconfig.io.zip)

Basierend auf [https://www.digitalocean.com/community/tools/nginx](https://www.digitalocean.com/community/tools/nginx)

### Technische Details

#### Hash-basierte Verifikation
- SHA256-Hashes für präzise Dateivergleiche
- Erkennung von Inhalt, Größe und Änderungszeit
- Robuste Fehlerbehandlung bei Zugriffsproblemen

#### Sichere Synchronisation
- Explizite Benutzerbestätigung vor Überschreibungen
- Automatische Verzeichniserstellung
- Detaillierte Logging-Informationen
- Rollback-Möglichkeit durch Backup-System

#### Flexible Pfad-Konfiguration
- Anpassbare lokale Pfade (Standard: `yaml_examples/`)
- Konfigurierbare Server-Pfade (Standard: `/etc/nginx/`)
- Unterstützung für verschiedene nginx-Installationen

### Erweiterte Nutzung

#### Kombinierte Befehle
```bash
# Backup + Verifikation in einem Workflow
nginx-set-conf --backup_config && nginx-set-conf --verify_config
```

#### Mit anderen Optionen kombinieren
```bash
# Verifikation mit Dry-Run
nginx-set-conf --verify_config --dry_run
```

### Fehlerbehebung

#### Häufige Probleme

1. **Berechtigung verweigert**: Sicherstellen, dass der Benutzer Schreibrechte für `/etc/nginx/` hat
2. **Verzeichnisse fehlen**: Tool erstellt automatisch fehlende Verzeichnisse
3. **Backup-Speicher voll**: Alte Backups aus `/tmp/nginx_backup/` entfernen

#### Logging
Alle Operationen werden geloggt in:
- Konsole: INFO-Level
- Datei: `nginx_set_conf.log` (mit Rotation)

### Sicherheitsaspekte

- **Keine automatischen Änderungen**: Alle Änderungen erfordern explizite Bestätigung
- **Backup-First-Ansatz**: Backup vor jeder Synchronisation empfohlen
- **Granulare Kontrolle**: Einzelne Dateien können identifiziert und behandelt werden
- **Fehlerbehandlung**: Robuste Behandlung von Permissions- und Zugriffsproblemen

### Lizenz

Dieses Projekt ist unter den Bedingungen der **AGPLv3**-Lizenz lizenziert.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/equitania/nginx-set-conf",
    "name": "nginx-set-conf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "nginx, configuration, docker, reverse-proxy",
    "author": "Equitania Software GmbH",
    "author_email": "info@equitania.de",
    "download_url": "https://files.pythonhosted.org/packages/5d/1f/000cc75d2f12df9413500b61d4fe9ae4a08a49970c997c2e13c7b55a32f3/nginx_set_conf-1.5.4.tar.gz",
    "platform": null,
    "description": "# nginx-set-conf\n\n[\ud83c\uddec\ud83c\udde7 English Version](#english-version) | [\ud83c\udde9\ud83c\uddea Deutsche Version](#deutsche-version)\n\n---\n\n## \ud83c\uddec\ud83c\udde7 English Version\n\nA simple Python library that helps you create nginx configurations for different Docker-based applications with nginx as reverse proxy, including configuration verification features.\n\n### Features\n\n- **Template-based configuration**: Support for 15+ pre-built templates\n- **SSL/TLS support**: Automatic Let's Encrypt integration\n- **Configuration verification**: Check consistency between local and server files\n- **Configuration verification**: Check if required nginx files exist\n- **Backup functionality**: Automatic backup of server configurations\n- **Dry run mode**: Test configurations without applying changes\n- **PDF MIME-Type optimization**: Enhanced PDF handling for Odoo applications\n\n### Installation\n\n#### Requirements\n\n- Python (>= 3.10)\n- click (>= 8.2.1)\n- PyYAML (>= 6.0.2)\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install nginx-set-conf:\n\n```bash\npip install nginx-set-conf\n```\n\n### Usage\n\n#### Basic Usage\n\n```bash\n$ nginx-set-conf --help\n```\n\n#### Supported Templates\n\n- `ngx_code_server` - Code-server with SSL\n- `ngx_fast_report` - FastReport with SSL\n- `ngx_flowise` - Flowise AI with SSL/HTTP2\n- `ngx_kasm` - Kasm Workspaces with SSL/HTTP2\n- `ngx_mailpit` - Mailpit with SSL/HTTP2\n- `ngx_n8n` - n8n with SSL/HTTP2\n- `ngx_nextcloud` - NextCloud with SSL\n- `ngx_odoo_http` - Odoo HTTP only\n- `ngx_odoo_ssl` - Odoo with SSL\n- `ngx_pgadmin` - pgAdmin4 with SSL\n- `ngx_portainer` - Portainer with SSL\n- `ngx_pwa` - Progressive Web App with SSL\n- `ngx_qdrant` - Qdrant vector database with SSL/HTTP2 and gRPC\n- `ngx_redirect` - Domain redirect without SSL\n- `ngx_redirect_ssl` - Domain redirect with SSL\n- `ngx_supabase` - Supabase database server with SSL/HTTP2\n\n#### Configuration Management Options\n\n- `--verify_config` - Check consistency between local and server config files\n- `--create_dirs` - Create missing nginx configuration directories\n- `--backup_config` - Create backup of current server configuration\n\n### Examples\n\n#### Basic Configuration\n\n```bash\n# Using configuration file\nnginx-set-conf --config_path server_config\n\n# Direct configuration\nnginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --pollport 8072\n\n# Custom target path\nnginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --target_path /tmp/nginx-test\n\n# Dry run mode\nnginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --dry_run\n```\n\n#### Template Preview\n\n```bash\n# Show template configuration\nnginx-set-conf --config_template ngx_odoo_ssl --show_template\n\n# Show Qdrant template\nnginx-set-conf --config_template ngx_qdrant --show_template\n```\n\n#### Advanced Examples\n\n```bash\n# Qdrant with gRPC support\nnginx-set-conf --config_template ngx_qdrant --ip 1.2.3.4 --domain vector.example.com --port 6333 --grpcport 6334 --cert_name vector.example.com\n\n# Flowise AI server\nnginx-set-conf --config_template ngx_flowise --ip 1.2.3.4 --domain flowise.example.com --port 3000 --cert_name flowise.example.com\n\n# Supabase database server\nnginx-set-conf --config_template ngx_supabase --ip 1.2.3.4 --domain supabase.example.com --port 8000 --cert_name supabase.example.com\n```\n\n### Configuration Verification\n\n#### 1. Configuration File Check (`--verify_config`)\n\nCheck if required nginx configuration files exist on the server:\n\n```bash\nnginx-set-conf --verify_config\n```\n\n**Checked Files:**\n- `/etc/nginx/nginx.conf`\n- `/etc/nginx/nginxconfig.io/general.conf`\n- `/etc/nginx/nginxconfig.io/security.conf`\n- `/etc/nginx/nginxconfig.io/ssl_stapling.conf`\n\n**Output:**\n- \u2713 EXISTS: File is present on the server\n- \u2717 MISSING: File not found\n- Shows file path and size for existing files\n\n#### 2. Create Missing Directories (`--create_dirs`)\n\nCreate missing nginx configuration directories if needed:\n\n```bash\nnginx-set-conf --create_dirs\n```\n\n**What it does:**\n- Checks for missing files\n- Creates `/etc/nginx/nginxconfig.io/` directory if missing\n- Useful after fresh nginx installation\n\n**Security Features:**\n- Confirmation before overwriting files\n- Automatic directory creation\n- Error handling for access problems\n\n#### 3. Configuration Backup (`--backup_config`)\n\nCreate automatic backups of current server configuration:\n\n```bash\nnginx-set-conf --backup_config\n```\n\n**Backup Features:**\n- Timestamp-based backup folders: `/tmp/nginx_backup/nginx_config_backup_YYYYMMDD_HHMMSS`\n- Complete backup of `/etc/nginx/nginx.conf`\n- Recursive backup of `nginxconfig.io/` directory\n- Logging of all backup operations\n\n### Practical Usage Scenarios\n\n#### Scenario 1: Consistency Check Before Deployment\n\n```bash\n# Check before deployment\nnginx-set-conf --verify_config\n\n# If inconsistencies found: Create backup\nnginx-set-conf --backup_config\n\n# If directories missing, create them\nnginx-set-conf --create_dirs\n```\n\n#### Scenario 2: Server Setup Adoption\n\n```bash\n# Backup current server configuration\nnginx-set-conf --backup_config\n\n# Create missing directories if needed\nnginx-set-conf --create_dirs\n\n# Verify result\nnginx-set-conf --verify_config\n```\n\n#### Scenario 3: Fresh nginx Installation\n\n```bash\n# Check if all required files exist\nnginx-set-conf --verify_config\n\n# If directories are missing, create them\nnginx-set-conf --create_dirs\n```\n\n### SSL Certificate Management\n\n#### Create Let's Encrypt Certificate\n\n```bash\ncertbot certonly --standalone --agree-tos --register-unsafely-without-email -d www.example.com\n```\n\n#### Install certbot on Debian/Ubuntu\n\n```bash\napt-get install certbot\n```\n\n#### Create Authentication File\n\n```bash\n# Install htpasswd on Debian/Ubuntu\napt-get install apache2-utils\nhtpasswd -c /etc/nginx/.htaccess/.htpasswd-user USER\n```\n\n### Nginx Template Settings\n\nYou can download our optimized settings:\n- [nginx.conf](https://rm.ownerp.io/staff/nginx.conf)\n- [nginxconfig.io.zip](https://rm.ownerp.io/staff/nginxconfig.io.zip)\n\nBased on [https://www.digitalocean.com/community/tools/nginx](https://www.digitalocean.com/community/tools/nginx)\n\n### Technical Details\n\n#### Hash-based Verification\n- SHA256 hashes for precise file comparisons\n- Detection of content, size, and modification time\n- Robust error handling for access problems\n\n#### Secure Synchronization\n- Explicit user confirmation before overwrites\n- Automatic directory creation\n- Detailed logging information\n- Rollback possibility through backup system\n\n#### Flexible Path Configuration\n- Customizable local paths (default: `yaml_examples/`)\n- Configurable server paths (default: `/etc/nginx/`)\n- Support for different nginx installations\n\n### Advanced Usage\n\n#### Combined Commands\n```bash\n# Backup + Verification in one workflow\nnginx-set-conf --backup_config && nginx-set-conf --verify_config\n```\n\n#### Combining with Other Options\n```bash\n# Verification with Dry-Run\nnginx-set-conf --verify_config --dry_run\n```\n\n### Troubleshooting\n\n#### Common Issues\n\n1. **Permission denied**: Ensure user has write permissions for `/etc/nginx/`\n2. **Missing directories**: Tool automatically creates missing directories\n3. **Backup storage full**: Remove old backups from `/tmp/nginx_backup/`\n\n#### Logging\nAll operations are logged to:\n- Console: INFO level\n- File: `nginx_set_conf.log` (with rotation)\n\n### Security Aspects\n\n- **No automatic changes**: All changes require explicit confirmation\n- **Backup-first approach**: Backup recommended before configuration changes\n- **Granular control**: Individual files can be identified and handled\n- **Error handling**: Robust handling of permission and access problems\n\n### License\n\nThis project is licensed under the terms of the **AGPLv3** license.\n\n---\n\n## \ud83c\udde9\ud83c\uddea Deutsche Version\n\nEine einfache Python-Bibliothek, die bei der Erstellung von nginx-Konfigurationen f\u00fcr verschiedene Docker-basierte Anwendungen mit nginx als Reverse-Proxy hilft, einschlie\u00dflich erweiterten Konfigurationsverifikations- und Synchronisationsfunktionen.\n\n### Funktionen\n\n- **Template-basierte Konfiguration**: Unterst\u00fctzung f\u00fcr 15+ vorgefertigte Templates\n- **SSL/TLS-Unterst\u00fctzung**: Automatische Let's Encrypt Integration\n- **Konfigurationsverifikation**: Konsistenzpr\u00fcfung zwischen lokalen und Server-Dateien\n- **Interaktive Synchronisation**: Synchronisation von Konfigurationen zwischen lokal und Server\n- **Backup-Funktionalit\u00e4t**: Automatische Sicherung von Server-Konfigurationen\n- **Dry-Run-Modus**: Konfigurationen testen ohne \u00c4nderungen anzuwenden\n- **PDF MIME-Type-Optimierung**: Verbesserte PDF-Behandlung f\u00fcr Odoo-Anwendungen\n\n### Installation\n\n#### Anforderungen\n\n- Python (>= 3.10)\n- click (>= 8.2.1)\n- PyYAML (>= 6.0.2)\n\nVerwenden Sie den Paketmanager [pip](https://pip.pypa.io/en/stable/) zur Installation von nginx-set-conf:\n\n```bash\npip install nginx-set-conf\n```\n\n### Verwendung\n\n#### Grundlegende Verwendung\n\n```bash\n$ nginx-set-conf --help\n```\n\n#### Unterst\u00fctzte Templates\n\n- `ngx_code_server` - Code-Server mit SSL\n- `ngx_fast_report` - FastReport mit SSL\n- `ngx_flowise` - Flowise AI mit SSL/HTTP2\n- `ngx_kasm` - Kasm Workspaces mit SSL/HTTP2\n- `ngx_mailpit` - Mailpit mit SSL/HTTP2\n- `ngx_n8n` - n8n mit SSL/HTTP2\n- `ngx_nextcloud` - NextCloud mit SSL\n- `ngx_odoo_http` - Odoo nur HTTP\n- `ngx_odoo_ssl` - Odoo mit SSL\n- `ngx_pgadmin` - pgAdmin4 mit SSL\n- `ngx_portainer` - Portainer mit SSL\n- `ngx_pwa` - Progressive Web App mit SSL\n- `ngx_qdrant` - Qdrant Vektordatenbank mit SSL/HTTP2 und gRPC\n- `ngx_redirect` - Domain-Weiterleitung ohne SSL\n- `ngx_redirect_ssl` - Domain-Weiterleitung mit SSL\n- `ngx_supabase` - Supabase Datenbankserver mit SSL/HTTP2\n\n#### Konfigurationsverwaltungsoptionen\n\n- `--verify_config` - Pr\u00fcfen ob ben\u00f6tigte nginx Konfigurationsdateien existieren\n- `--create_dirs` - Fehlende nginx Konfigurationsverzeichnisse erstellen\n- `--backup_config` - Backup der aktuellen Server-Konfiguration erstellen\n\n### Beispiele\n\n#### Grundkonfiguration\n\n```bash\n# Verwendung von Konfigurationsdatei\nnginx-set-conf --config_path server_config\n\n# Direkte Konfiguration\nnginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --pollport 8072\n\n# Benutzerdefinierter Zielpfad\nnginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --target_path /tmp/nginx-test\n\n# Dry-Run-Modus\nnginx-set-conf --config_template ngx_odoo_ssl --ip 1.2.3.4 --domain www.example.com --port 8069 --cert_name www.example.com --dry_run\n```\n\n#### Template-Vorschau\n\n```bash\n# Template-Konfiguration anzeigen\nnginx-set-conf --config_template ngx_odoo_ssl --show_template\n\n# Qdrant-Template anzeigen\nnginx-set-conf --config_template ngx_qdrant --show_template\n```\n\n#### Erweiterte Beispiele\n\n```bash\n# Qdrant mit gRPC-Unterst\u00fctzung\nnginx-set-conf --config_template ngx_qdrant --ip 1.2.3.4 --domain vector.example.com --port 6333 --grpcport 6334 --cert_name vector.example.com\n\n# Flowise AI Server\nnginx-set-conf --config_template ngx_flowise --ip 1.2.3.4 --domain flowise.example.com --port 3000 --cert_name flowise.example.com\n\n# Supabase Datenbankserver\nnginx-set-conf --config_template ngx_supabase --ip 1.2.3.4 --domain supabase.example.com --port 8000 --cert_name supabase.example.com\n```\n\n### Konfigurationsverifikation\n\n#### 1. Konfigurationsdatei-Pr\u00fcfung (`--verify_config`)\n\nPr\u00fcfen ob ben\u00f6tigte nginx Konfigurationsdateien auf dem Server existieren:\n\n```bash\nnginx-set-conf --verify_config\n```\n\n**Gepr\u00fcfte Dateien:**\n- `/etc/nginx/nginx.conf`\n- `/etc/nginx/nginxconfig.io/general.conf`\n- `/etc/nginx/nginxconfig.io/security.conf`\n- `/etc/nginx/nginxconfig.io/ssl_stapling.conf`\n\n**Ausgabe:**\n- \u2713 EXISTS: Datei ist auf dem Server vorhanden\n- \u2717 MISSING: Datei nicht gefunden\n- Zeigt Dateipfad und Gr\u00f6\u00dfe f\u00fcr existierende Dateien\n\n#### 2. Fehlende Verzeichnisse erstellen (`--create_dirs`)\n\nFehlende nginx Konfigurationsverzeichnisse bei Bedarf erstellen:\n\n```bash\nnginx-set-conf --create_dirs\n```\n\n**Was es tut:**\n- Pr\u00fcft auf fehlende Dateien\n- Erstellt `/etc/nginx/nginxconfig.io/` Verzeichnis falls fehlend\n- N\u00fctzlich nach frischer nginx Installation\n\n#### 3. Konfigurationsbackup (`--backup_config`)\n\nAutomatische Backups der aktuellen Server-Konfiguration erstellen:\n\n```bash\nnginx-set-conf --backup_config\n```\n\n**Backup-Funktionen:**\n- Zeitstempel-basierte Backup-Ordner: `/tmp/nginx_backup/nginx_config_backup_YYYYMMDD_HHMMSS`\n- Vollst\u00e4ndige Sicherung von `/etc/nginx/nginx.conf`\n- Rekursive Sicherung des `nginxconfig.io/` Verzeichnisses\n- Logging aller Backup-Operationen\n\n### Praktische Anwendungsszenarien\n\n#### Szenario 1: Konsistenzpr\u00fcfung vor Deployment\n\n```bash\n# Vor dem Deployment pr\u00fcfen\nnginx-set-conf --verify_config\n\n# Bei Inconsistenzen: Backup erstellen\nnginx-set-conf --backup_config\n\n# Bei fehlenden Verzeichnissen erstellen\nnginx-set-conf --create_dirs\n```\n\n#### Szenario 2: Server-Setup \u00fcbernehmen\n\n```bash\n# Aktuelle Server-Konfiguration sichern\nnginx-set-conf --backup_config\n\n# Fehlende Verzeichnisse erstellen falls n\u00f6tig\nnginx-set-conf --create_dirs\n# Option 1 w\u00e4hlen: Local \u2192 Server\n\n# Ergebnis \u00fcberpr\u00fcfen\nnginx-set-conf --verify_config\n```\n\n#### Szenario 3: Neue nginx Installation pr\u00fcfen\n\n```bash\n# Pr\u00fcfen ob alle Dateien vorhanden sind\nnginx-set-conf --verify_config\n\n# Falls Verzeichnisse fehlen, diese erstellen\nnginx-set-conf --create_dirs\n```\n\n### SSL-Zertifikatsverwaltung\n\n#### Let's Encrypt Zertifikat erstellen\n\n```bash\ncertbot certonly --standalone --agree-tos --register-unsafely-without-email -d www.example.com\n```\n\n#### certbot auf Debian/Ubuntu installieren\n\n```bash\napt-get install certbot\n```\n\n#### Authentifizierungsdatei erstellen\n\n```bash\n# htpasswd auf Debian/Ubuntu installieren\napt-get install apache2-utils\nhtpasswd -c /etc/nginx/.htaccess/.htpasswd-user USER\n```\n\n### Nginx-Template-Einstellungen\n\nSie k\u00f6nnen unsere optimierten Einstellungen herunterladen:\n- [nginx.conf](https://rm.ownerp.io/staff/nginx.conf)\n- [nginxconfig.io.zip](https://rm.ownerp.io/staff/nginxconfig.io.zip)\n\nBasierend auf [https://www.digitalocean.com/community/tools/nginx](https://www.digitalocean.com/community/tools/nginx)\n\n### Technische Details\n\n#### Hash-basierte Verifikation\n- SHA256-Hashes f\u00fcr pr\u00e4zise Dateivergleiche\n- Erkennung von Inhalt, Gr\u00f6\u00dfe und \u00c4nderungszeit\n- Robuste Fehlerbehandlung bei Zugriffsproblemen\n\n#### Sichere Synchronisation\n- Explizite Benutzerbest\u00e4tigung vor \u00dcberschreibungen\n- Automatische Verzeichniserstellung\n- Detaillierte Logging-Informationen\n- Rollback-M\u00f6glichkeit durch Backup-System\n\n#### Flexible Pfad-Konfiguration\n- Anpassbare lokale Pfade (Standard: `yaml_examples/`)\n- Konfigurierbare Server-Pfade (Standard: `/etc/nginx/`)\n- Unterst\u00fctzung f\u00fcr verschiedene nginx-Installationen\n\n### Erweiterte Nutzung\n\n#### Kombinierte Befehle\n```bash\n# Backup + Verifikation in einem Workflow\nnginx-set-conf --backup_config && nginx-set-conf --verify_config\n```\n\n#### Mit anderen Optionen kombinieren\n```bash\n# Verifikation mit Dry-Run\nnginx-set-conf --verify_config --dry_run\n```\n\n### Fehlerbehebung\n\n#### H\u00e4ufige Probleme\n\n1. **Berechtigung verweigert**: Sicherstellen, dass der Benutzer Schreibrechte f\u00fcr `/etc/nginx/` hat\n2. **Verzeichnisse fehlen**: Tool erstellt automatisch fehlende Verzeichnisse\n3. **Backup-Speicher voll**: Alte Backups aus `/tmp/nginx_backup/` entfernen\n\n#### Logging\nAlle Operationen werden geloggt in:\n- Konsole: INFO-Level\n- Datei: `nginx_set_conf.log` (mit Rotation)\n\n### Sicherheitsaspekte\n\n- **Keine automatischen \u00c4nderungen**: Alle \u00c4nderungen erfordern explizite Best\u00e4tigung\n- **Backup-First-Ansatz**: Backup vor jeder Synchronisation empfohlen\n- **Granulare Kontrolle**: Einzelne Dateien k\u00f6nnen identifiziert und behandelt werden\n- **Fehlerbehandlung**: Robuste Behandlung von Permissions- und Zugriffsproblemen\n\n### Lizenz\n\nDieses Projekt ist unter den Bedingungen der **AGPLv3**-Lizenz lizenziert.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python library for generating nginx reverse proxy configurations for Docker applications.",
    "version": "1.5.4",
    "project_urls": {
        "Homepage": "https://github.com/equitania/nginx-set-conf"
    },
    "split_keywords": [
        "nginx",
        " configuration",
        " docker",
        " reverse-proxy"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "aae58574692e4afeeeab9766a72b7b476dab1f4fd32aaa72b157118f56b3bfed",
                "md5": "03e9c037df62366d29bd5fe1f2dc355b",
                "sha256": "cf037febeecd21876d3f7dc0979920c0d96f912e6c902f7b099e28404cccc098"
            },
            "downloads": -1,
            "filename": "nginx_set_conf-1.5.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "03e9c037df62366d29bd5fe1f2dc355b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 55943,
            "upload_time": "2025-07-28T15:31:03",
            "upload_time_iso_8601": "2025-07-28T15:31:03.175501Z",
            "url": "https://files.pythonhosted.org/packages/aa/e5/8574692e4afeeeab9766a72b7b476dab1f4fd32aaa72b157118f56b3bfed/nginx_set_conf-1.5.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5d1f000cc75d2f12df9413500b61d4fe9ae4a08a49970c997c2e13c7b55a32f3",
                "md5": "cd01ff4f4e0366d90707ff9cdbcb115d",
                "sha256": "283dbcc27be90ba05e617948adc7350ce9bf22b445fc0a2db077cb5bec10d6da"
            },
            "downloads": -1,
            "filename": "nginx_set_conf-1.5.4.tar.gz",
            "has_sig": false,
            "md5_digest": "cd01ff4f4e0366d90707ff9cdbcb115d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 42295,
            "upload_time": "2025-07-28T15:31:04",
            "upload_time_iso_8601": "2025-07-28T15:31:04.534148Z",
            "url": "https://files.pythonhosted.org/packages/5d/1f/000cc75d2f12df9413500b61d4fe9ae4a08a49970c997c2e13c7b55a32f3/nginx_set_conf-1.5.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-28 15:31:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "equitania",
    "github_project": "nginx-set-conf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "nginx-set-conf"
}
        
Elapsed time: 0.74925s