From cf30da5b1ed6d5c2098efbaf3bad4e1c5a98f1e5 Mon Sep 17 00:00:00 2001 From: HypoxiE Date: Mon, 25 Aug 2025 14:22:20 +0700 Subject: [PATCH] first commit --- Dockerfile | 3 +++ docker-compose.yml | 18 ++++++++++++++++++ nginx.conf | 13 +++++++++++++ pgen.py | 19 +++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf create mode 100644 pgen.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d7bdd90 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:alpine + +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2a52da3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +networks: + nginx_network_external: + name: nginx_network_external + attachable: true +services: + nginx: + build: . + container_name: nginx + image: nginx + ports: + - "443:443" + - "80:80" + restart: always + networks: + - nginx_network_external + volumes: + - /etc/letsencrypt:/etc/letsencrypt:ro + - ./nginx.conf:/etc/nginx/nginx.conf:ro \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..5dbf689 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,13 @@ +events {} + + +http { + + server { + listen 80; + server_name localhost; + location / { + proxy_pass http://kosma-3x-ui:2053/; + } + } +} \ No newline at end of file diff --git a/pgen.py b/pgen.py new file mode 100644 index 0000000..c9b4fb0 --- /dev/null +++ b/pgen.py @@ -0,0 +1,19 @@ +# Код для генерации портов для служб в nginx.conf + +import random +import re + +with open("nginx.conf") as file: + busy_ports = {443, 80} + for line in file.readlines(): + match = re.match(r'^\s*listen\s+(\d+)\s*;', line) + if match: + port = int(match.group(1)) + busy_ports = busy_ports | {port} + + available = [x for x in range(5000, 65535 + 1) if x not in busy_ports] + if available: + number = random.choice(available) + print(number) + else: + print("Нет доступных портов")