ваше сообщение коммита
This commit is contained in:
@@ -32,9 +32,33 @@ http {
|
||||
~*MSIE\ [1-9]\. 1;
|
||||
}
|
||||
|
||||
# HTTP сервер - редирект на HTTPS
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
server_name ${DOMAIN};
|
||||
|
||||
# Редирект всех HTTP запросов на HTTPS
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
# HTTPS сервер
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name ${DOMAIN};
|
||||
|
||||
# SSL конфигурация (автоматически обновляется certbot)
|
||||
ssl_certificate /etc/ssl/certs/live/${DOMAIN}/fullchain.pem;
|
||||
ssl_certificate_key /etc/ssl/certs/live/${DOMAIN}/privkey.pem;
|
||||
|
||||
# Современные SSL настройки
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 10m;
|
||||
|
||||
# HSTS
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
@@ -66,6 +90,19 @@ http {
|
||||
return 404;
|
||||
}
|
||||
|
||||
# Healthcheck endpoint
|
||||
location /health {
|
||||
access_log off;
|
||||
return 200 "healthy\n";
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
|
||||
# Certbot webroot для автоматического получения SSL сертификатов
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
# Основной location
|
||||
location / {
|
||||
# Rate limiting для основных страниц
|
||||
@@ -73,12 +110,12 @@ http {
|
||||
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
# Базовые заголовки безопасности
|
||||
# Базовые заголовки безопасности для HTTPS
|
||||
add_header X-Frame-Options "DENY" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' ws: wss:;" always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' wss:;" always;
|
||||
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
|
||||
}
|
||||
|
||||
@@ -97,7 +134,7 @@ http {
|
||||
# Rate limiting для API (более строгое)
|
||||
limit_req zone=api_limit_per_ip burst=10 nodelay;
|
||||
|
||||
proxy_pass http://dapp-backend:8000/api/;
|
||||
proxy_pass http://${BACKEND_CONTAINER}:8000/api/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
@@ -109,6 +146,20 @@ http {
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
}
|
||||
|
||||
# WebSocket поддержка (HTTPS)
|
||||
location /ws {
|
||||
proxy_pass http://${BACKEND_CONTAINER}:8000/ws;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
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 https;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
}
|
||||
|
||||
# Скрытие информации о сервере
|
||||
server_tokens off;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user