Problem: - Daemon-Service verwendet libwebsockets mit benutzerdefiniertem Protokoll - Frontend versuchte Standard-WebSocket-Verbindung ohne Protokoll - JSON-Nachrichten fehlten user_id Feld Lösung: - WebSocket-Verbindung mit 'yourpart-protocol' Protokoll - JSON-Nachrichten mit user_id Feld korrigiert - Apache-Konfiguration für benutzerdefiniertes Protokoll angepasst Protokoll-Details: - Protokoll: 'yourpart-protocol' (libwebsockets C-Bibliothek) - Port: 4551 (Daemon-Service) - Ping/Pong: Alle 30 Sekunden - Message-Format: JSON mit user_id Feld - Events: setUserId, getWorkerStatus, production_ready, etc. Frontend-Änderungen: - new WebSocket(url, 'yourpart-protocol') - JSON mit user_id: state.user.id - Apache: ProxyPass mit upgrade=websocket für /ws/
61 lines
2.0 KiB
Plaintext
61 lines
2.0 KiB
Plaintext
<IfModule mod_ssl.c>
|
|
<VirtualHost your-part.de:443>
|
|
ServerAdmin webmaster@your-part.de
|
|
ServerName your-part.de
|
|
ServerAlias www.your-part.de
|
|
|
|
DocumentRoot /opt/yourpart/frontend/dist
|
|
|
|
DirectoryIndex index.html
|
|
|
|
# Frontend statische Dateien
|
|
<Directory "/opt/yourpart/frontend/dist">
|
|
AllowOverride None
|
|
Options -Indexes +FollowSymLinks
|
|
Require all granted
|
|
|
|
# Fallback für Vue Router
|
|
FallbackResource /index.html
|
|
</Directory>
|
|
|
|
# API-Requests an Backend weiterleiten
|
|
ProxyPass "/api/" "http://localhost:2020/api/"
|
|
ProxyPassReverse "/api/" "http://localhost:2020/api/"
|
|
|
|
# WebSocket-Requests an Backend weiterleiten
|
|
ProxyPass "/socket.io/" "http://localhost:2020/socket.io/"
|
|
ProxyPassReverse "/socket.io/" "http://localhost:2020/socket.io/"
|
|
|
|
# WebSocket-Upgrade-Header für Socket.io
|
|
RewriteEngine on
|
|
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
|
RewriteCond %{HTTP:Connection} upgrade [NC]
|
|
RewriteRule ^/socket.io/(.*)$ "ws://localhost:2020/socket.io/$1" [P,L]
|
|
|
|
# WebSocket-Upgrade-Header für Daemon-Verbindungen
|
|
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
|
RewriteCond %{HTTP:Connection} upgrade [NC]
|
|
RewriteRule ^/ws/(.*)$ "ws://localhost:4551/$1" [P,L]
|
|
|
|
# WebSocket-Proxy für Daemon-Verbindungen mit benutzerdefiniertem Protokoll
|
|
ProxyPass "/ws/" "ws://localhost:4551/" upgrade=websocket
|
|
ProxyPassReverse "/ws/" "ws://localhost:4551/"
|
|
|
|
ErrorLog /var/log/apache2/yourpart.error.log
|
|
CustomLog /var/log/apache2/yourpart.access.log combined
|
|
|
|
HostnameLookups Off
|
|
UseCanonicalName Off
|
|
ServerSignature On
|
|
|
|
# SSL-Konfiguration
|
|
Include /etc/letsencrypt/options-ssl-apache.conf
|
|
SSLCertificateFile /etc/letsencrypt/live/www.your-part.de/fullchain.pem
|
|
SSLCertificateKeyFile /etc/letsencrypt/live/www.your-part.de/privkey.pem
|
|
|
|
# www Redirect
|
|
RewriteCond %{SERVER_NAME} =your-part.de
|
|
RewriteRule ^ https://www.%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
|
|
</VirtualHost>
|
|
</IfModule>
|