This document describes how to do a full deployment of Firefox Send on your own Linux server. You will need:
For Debian/Ubuntu systems this probably just means something like this:
To have a permanently running version of Firefox Send as a background process:
Create a file "run.sh" with:
#!/bin/bash
nohup su www-data -c "npm run prod" 2>/dev/null &
chmod +x run.sh
./run.sh
Now the Firefox Send backend should be running on port 1443. You can check with:
Of course, we don't want to expose the service on port 1443. Instead we want our normal webserver to forward all requests to Firefox send ("Reverse proxy").
In your Apache virtual host configuration file, insert this:
# Enable rewrite engine
RewriteEngine on
# Make sure the original domain name is forwarded to Send
# Otherwise the generated URLs will be wrong
ProxyPreserveHost on
# Make sure the generated URL is https://
RequestHeader set X-Forwarded-Proto https
# If it's a normal file (e.g. PNG, CSS) just return it
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* - [L]
# If it's a websocket connection, redirect it to a Send WS connection
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:1443/$1 [P,L]
# Otherwise redirect it to a normal HTTP connection
RewriteRule ^/(.*)$ http://127.0.0.1:1443/$1 [P,QSA]
ProxyPassReverse "/" "http://127.0.0.1:1443"