upstream backend_upstream { server support-backend:8000; } upstream frontend_upstream { server administrationitdepartmens-frontend-1:5173; } # Редирект с HTTP на HTTPS server { listen 80; server_name itformhelp.ru www.itformhelp.ru; location /.well-known/acme-challenge/ { root /var/www/certbot; } location / { return 301 https://$host$request_uri; } } # Основной HTTPS сервер server { listen 443 ssl; server_name itformhelp.ru www.itformhelp.ru; ssl_certificate /etc/letsencrypt/live/itformhelp.ru/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/itformhelp.ru/privkey.pem; # Рекомендуемые настройки SSL ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers off; ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_stapling on; ssl_stapling_verify on; add_header Strict-Transport-Security "max-age=31536000" always; root /usr/share/nginx/html; index index.html; # Logging access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; # Frontend proxy location / { proxy_pass http://frontend_upstream; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; 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; } # API proxy location /api/ { proxy_pass http://backend_upstream; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; 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; } } # Редирект с IP на домен server { listen 80; server_name 185.139.70.62; return 301 https://itformhelp.ru$request_uri; }