flip:web:nginx_examples
Различия
Показаны различия между двумя версиями страницы.
| flip:web:nginx_examples [2025/05/23 12:02] – создано flip | flip:web:nginx_examples [2025/08/02 09:36] (текущий) – flip | ||
|---|---|---|---|
| Строка 298: | Строка 298: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | |||
| + | ===== Реверс прокси с веб сокетом ===== | ||
| + | |||
| + | < | ||
| + | server { | ||
| + | |||
| + | listen 8000 ssl; | ||
| + | server_name example.com; | ||
| + | |||
| + | ssl_certificate / | ||
| + | ssl_certificate_key / | ||
| + | |||
| + | # Опционально: | ||
| + | ssl_protocols TLSv1.2 TLSv1.3; | ||
| + | ssl_ciphers ' | ||
| + | ssl_prefer_server_ciphers on; | ||
| + | |||
| + | location / { | ||
| + | proxy_pass http:// | ||
| + | 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_redirect http:// | ||
| + | } | ||
| + | |||
| + | # Отдельный блок для WebSocket (/ws) | ||
| + | location /ws { | ||
| + | proxy_pass http:// | ||
| + | |||
| + | # Обязательные настройки для WebSocket | ||
| + | proxy_http_version 1.1; | ||
| + | proxy_set_header Upgrade $http_upgrade; | ||
| + | proxy_set_header Connection " | ||
| + | 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_read_timeout 86400s; | ||
| + | proxy_send_timeout 86400s; | ||
| + | } | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
flip/web/nginx_examples.1748001720.txt.gz · Последнее изменение: 2025/05/23 12:02 — flip
