first commit

This commit is contained in:
2025-08-25 14:22:20 +07:00
commit cf30da5b1e
4 changed files with 53 additions and 0 deletions

3
Dockerfile Normal file
View File

@@ -0,0 +1,3 @@
FROM nginx:alpine
CMD ["nginx", "-g", "daemon off;"]

18
docker-compose.yml Normal file
View File

@@ -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

13
nginx.conf Normal file
View File

@@ -0,0 +1,13 @@
events {}
http {
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://kosma-3x-ui:2053/;
}
}
}

19
pgen.py Normal file
View File

@@ -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("Нет доступных портов")