Step 2: Write a record in DNS for the external address where the module is published
As a rule, it is done through the personal cabinet of the provider that serves the client's domain.
Step 3. Issue SSL certificate
If the client already has a certificate, then copy the files (the certificate itself, the key) to the server with the module. If there is no certificate, then issue it (there are many solutions here).
When a certificate is reissued, the service must be restarted for the module to load the updated certificate files.
This example shows how to set up a WSS connection using Nginx or Apache
Configuration for Nginx
Open the Nginx configuration file:
nano/etc/nginx/nginx.conf
Add configuration for WSS:
server{listen443ssl;server_nameyour_domain.com;ssl_certificate/etc/nginx/ssl/server.crt; # Or the path to your SSL certificate from Let's Encryptssl_certificate_key/etc/nginx/ssl/server.key;location/ws/{proxy_passwss://freepbx.example.com:8078; # The address of your WebSocket serverproxy_http_version1.1;proxy_set_headerUpgrade $http_upgrade;proxy_set_headerConnection"Upgrade";proxy_set_headerHost $host;proxy_set_headerX-Real-IP $remote_addr;proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_headerX-Forwarded-Proto $scheme;proxy_read_timeout86400;proxy_set_headerOrigin""; }}
Check the configuration and restart Nginx:
nginx-tsystemctlrestartnginx
Configuration for Apache
Open the Apache configuration file:
nano/etc/httpd/conf.d/ssl.conf
Add or modify a configuration block for the WSS:
<VirtualHost *:443>ServerNameyour_domain.comSSLEngineonSSLCertificateFile/etc/httpd/ssl/server.crt# Or the path to your SSL certificate from Let's EncryptSSLCertificateKeyFile/etc/httpd/ssl/server.key<Location/ws/>ProxyPass"wss://freepbx.example.com:8078/"# The address of your WebSocket serverProxyPassReverse"wss://freepbx.example.com:8078/"ProxyPreserveHostOnRequestHeadersetConnection"upgrade"RequestHeadersetUpgrade"websocket"</Location></VirtualHost>