# ICQ WebChat — nginx, отдаёт Converse.js и проксирует WebSocket на Prosody # Порт 8081 (внутри сети icq_default), Caddy на vps02 проксирует на 10.8.0.2:8081 server { listen 8081; server_name chat.nixg.ru xmpp.nixg.ru; # Статика Converse.js root /usr/share/nginx/html; index index.html; # WebSocket XMPP (Converse.js подключается к wss://chat.nixg.ru/xmpp-websocket) location /xmpp-websocket { proxy_pass http://prosody:5280/xmpp-websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_read_timeout 3600s; # долгоживущий WS proxy_send_timeout 3600s; } # BOSH (если понадобится) location /http-bind { proxy_pass http://prosody:5280/http-bind; proxy_http_version 1.1; proxy_set_header Host $host; } # XEP-0156: host-meta (JSON) — чтобы клиенты находили WebSocket автоматически location = /.well-known/host-meta { default_type application/jrd+json; return 200 '{"links":[{"rel":"urn:xmpp:alt-connections:websocket","href":"wss://xmpp.nixg.ru/xmpp-websocket"},{"rel":"urn:xmpp:alt-connections:xbosh","href":"https://xmpp.nixg.ru/http-bind"}]}'; } location = /.well-known/host-meta.json { default_type application/jrd+json; return 200 '{"links":[{"rel":"urn:xmpp:alt-connections:websocket","href":"wss://xmpp.nixg.ru/xmpp-websocket"},{"rel":"urn:xmpp:alt-connections:xbosh","href":"https://xmpp.nixg.ru/http-bind"}]}'; } # Основная страница location / { try_files $uri $uri/ /index.html; } }