106 lines
3.5 KiB
Nginx Configuration File
106 lines
3.5 KiB
Nginx Configuration File
# Обработка HTTP-запросов, редирект на HTTPS
|
|
server {
|
|
listen 80;
|
|
server_name example.com; # Домен проекта
|
|
|
|
location / {
|
|
# Перенаправление с HTTP на HTTPS
|
|
if ($arg_url != "") {
|
|
return 301 $arg_url;
|
|
}
|
|
|
|
return 404 "URL-аргумент отсутствует";
|
|
}
|
|
}
|
|
|
|
# Обработка HTTPS-запросов (статический сайт и прокси)
|
|
server {
|
|
listen 443 ssl;
|
|
server_name example.com; # Домен проекта
|
|
|
|
# SSL настройки
|
|
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # Путь к SSL-сертификату
|
|
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # Путь к приватному ключу
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
|
|
# Обработка подписок
|
|
location /sub {
|
|
proxy_pass http://localhost:3001;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
add_header Content-Type text/plain;
|
|
add_header Content-Disposition inline;
|
|
add_header Cache-Control no-store;
|
|
add_header Pragma no-cache;
|
|
}
|
|
|
|
# Статический сайт
|
|
root /var/www/website; # Путь к статическому сайту
|
|
index index.html; # Основной файл
|
|
|
|
location / {
|
|
# Перенаправление с HTTP на HTTPS
|
|
if ($arg_url != "") {
|
|
return 301 $arg_url;
|
|
}
|
|
|
|
return 404 "URL-аргумент отсутствует";
|
|
}
|
|
|
|
# Вебхуки из main.py
|
|
location /webhook {
|
|
proxy_pass http://localhost:3001/webhook;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
|
|
# Вебхук Юкассы
|
|
location /yookassa/webhook {
|
|
proxy_pass http://localhost:3001/yookassa/webhook;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
|
|
# Вебхук FreeCassa
|
|
location /freekassa/webhook {
|
|
proxy_pass http://localhost:3001/freekassa/webhook;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
|
|
# Вебхук CryptoBot
|
|
location /cryptobot/webhook {
|
|
proxy_pass http://localhost:3001/cryptobot/webhook;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
}
|