passer par un alias pour les websockets

This commit is contained in:
2021-12-07 16:47:22 +01:00
parent 01da55e6d6
commit 6081e6a692
10 changed files with 45 additions and 120 deletions

View File

@ -9,23 +9,6 @@ Alias /ninegate /var/www/html/ninegate/web
</Directory>
%if %%getVar("ninegate_activate_websocket", 'non') == "oui"
Listen %%adresse_ip_eth0:%%ninegate_websocket_portexterne
<VirtualHost %%adresse_ip_eth0:%%ninegate_websocket_portexterne>
ErrorLog /var/log/apache2/ssl_error.log
CustomLog /var/log/apache2/ssl_access.log common
SSLEngine on
%if %%cert_type == "letsencrypt"
SSLCertificateFile /etc/ssl/letsencrypt/conf/live/%%ninegate_websocket_url/cert.pem
SSLCertificateKeyFile /etc/ssl/letsencrypt/conf/live/%%ninegate_websocket_url/privkey.pem
%else
SSLCertificateFile %%server_cert
SSLCertificateKeyFile %%server_key
%end if
SSLProtocol all -SSLv3 -SSLv2
ServerName %%ninegate_websocket_url
RewriteEngine On
ProxyPass / ws://%%adresse_ip_eth0:%%ninegate_websocket_portinterne retry=0 keepalive=On
ProxyPassReverse / ws://%%adresse_ip_eth0:%%ninegate_websocket_portinterne retry=0
</VirtualHost>
ProxyPass /wssninegate ws://0.0.0.0:5556 retry=0 keepalive=On
ProxyPassReverse /wssninegate ws://0.0.0.0:5556 retry=0
%end if

6
tmpl/ninegate-nginx.conf Normal file
View File

@ -0,0 +1,6 @@
location /wssninegate {
proxy_pass https://%%container_ip_web;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

View File

@ -52,14 +52,8 @@ parameters:
%end if
%if %%getVar("ninegate_activate_websocket", 'non') == "oui"
websocket_activate: true
websocket_host: %%ninegate_websocket_url
websocket_port: %%ninegate_websocket_portexterne
websocket_portinterne: %%ninegate_websocket_portinterne
%else
websocket_activate: false
websocket_host: %%web_url
websocket_port: 80
websocket_portinterne: 80
%end if
%if %%getVar("ninegate_activate_portal", 'non') == "oui"
portal_activate: true

11
tmpl/ninegate.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Ninegate websocket server
After=local-fs.target network.target
[Service]
Type=simple
ExecStart=/var/www/html/ninegate/bin/console gos:websocket:server --port 5556 -a 0.0.0.0 --no-debug -n -q --env=prod
Restart=on-watchdog
[Install]
WantedBy=multi-user.target