The Server module for Linguflex creates a HTTPS Webserver on Port 8000 and a Websocket SSL Server on Port 8001.
Note: Serving Elevenlabs TTS currently doesn't work. Serving RVC postprocessed chunks currently result in slightly higher pitched voice.
- Webserver access: Offers voice access to Linguflex from webbrowsers within the local network.
To open firewall settings for a specific port in Windows, follow these steps:
- Type "Firewall" in the taskbar search box and select "Windows Defender Firewall".
- Click on "Advanced settings".
- In the left panel, click on "Inbound Rules".
- Click on "New Rule..." in the right panel.
- Select "Port" and click "Next".
- Choose the protocol (usually TCP for servers) and enter "8000" for "Specific local ports".
- Choose "Allow the connection" and click "Next".
- Select the appropriate profiles (usually "Private" for home networks).
- Name the rule (e.g., "Port 8000 for Python Server") and click "Finish".
Repeat for Inbound and Outbound Rules for ports 8000 and 8001.
- Install OpenSSL if it is not already installed on your server. Use the appropriate command for your operating system:
- For Ubuntu/Debian-based Linux:
sudo apt-get install openssl
- For RedHat/Fedora-based Linux:
sudo yum install openssl
- For macOS:
brew install openssl
- For Windows, download it from OpenSSL's official website.
- For Ubuntu/Debian-based Linux:
-
Create a PFX Certificate File:
- Generate a new SSL certificate and key, then export them to a PFX file (
mycertificate.pfx
). Adjust the command with your server's IP and your details:openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 openssl pkcs12 -export -out mycertificate.pfx -inkey key.pem -in cert.pem
- You can replace
mycertificate
with any preferred file name.
- Generate a new SSL certificate and key, then export them to a PFX file (
-
Generate PEM Files from PFX:
- Extract the certificate:
openssl pkcs12 -in mycertificate.pfx -clcerts -nokeys -out mycertificate.pem
- Extract the private key:
openssl pkcs12 -in mycertificate.pfx -nocerts -nodes -out mycertificate-key.pem
- Extract the certificate:
- Reference the PEM files in your server configuration:
- Add the paths to the
mycertificate.pem
andmycertificate-key.pem
files in your server'ssettings.yaml
file.
- Add the paths to the
- Modify the Client JavaScript to Connect via SSL:
- Open the file
static/tts.js
. - Change the line containing the socket address to use the IP address of your server:
let socket_address = "wss://YOUR_SERVER_IP:8001";
- Replace
YOUR_SERVER_IP
with the actual IP address your server is running on.
- Open the file
- Provide this documentation to users who need to install the certificate on their client devices (e.g., phones).
- They should install the
mycertificate.pfx
on their devices to trust the SSL connection.
- They should install the
- You can change the ports linguflex is running on by changing port_ssl and port_websocket in the settings.yaml (remember to also adjust static/tts.js)