Lightweight deployment of Firefox send temporary file sharing service using Tencent cloud

Time:2021-10-22

Lightweight deployment of Firefox send temporary file sharing service using Tencent cloud

Firefox send is part of FirefoxtemporaryNetwork disk, it can be inFull platformuse,Web StyleOperation,No add ons required(andNo speed limit), can be used in any modern browser. Share in the form of hyperlink. You can set the shared fileDownload times, time and password, after the specified number or length of downloads is reached, the file automatically expires and is automatically deleted from the send server. To some extent, it is equivalent toBurn after reading

More importantly, Firefox send is aOpen source software。 (GitHub address)

This means that any user can build their own Firefox send

Unfortunately, due to the malicious use of criminals, on September 17, 2020, the official team Mozilla officially announced that the Firefox send service used to transfer files would be permanently closed.

Here is a record of how you deployed Firefox send

get ready

  • One ECS
  • Install pagoda panel

The recent Tencent cloud 618 activities are very good, includingLightweight 2-core 4g5mIt only costs 288 yuan a year

618 activity link: https://cloud.tencent.com/act…

Tencent cloud lightweight server link: https://cloud.tencent.com/act…

Lightweight deployment of Firefox send temporary file sharing service using Tencent cloud

install

The basic setup of Firefox send requires at least node.js 10. X

Install PM2 manager and redis in Pagoda

Select the appropriate node version in PM2 Manager (version 10. X or above is required)

In the official installation process, if NPM run build is executed by root user, there will be problems, and the errors are as follows:

mode: production

/var/www/send/node_modules/webpack/lib/optimize/ConcatenatedModule.js:679

          throw err;

          ^



SyntaxError: Unexpected token (3:25)

| !(function webpackMissingModule() { var e = new Error("Cannot find module 'webcrypto-core'"); e.code = 'MODULE_NOT_FOUND'; throw e; }());

| 

| class LinerError extends !(function webpackMissingModule() { var e = new Error("Cannot find module 'webcrypto-core'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()) {

|   constructor() {

|     super(...arguments);

...

So let’s create a new ordinary user

useradd -d /home/firefoxsend -m send

cd /home/firefoxsendEnter folder, enter executiongit clone https://github.com/mozilla/send.gitPull the source code from GitHub

If the domestic server pulls GitHub too slowly, you can first https://github.com/mozilla/send/releases Download locally and upload to the server

Change the user permission of Firefox send directory to new user send

chown -R send:send firefoxsend

After that, we modify webpack.config.js to turn off the automatic check. If the automatic check is turned off without modifying the parameters, the domain name cannot be accessed after binding.

Add at the position shown in the figure belowdisableHostCheck: true,

Lightweight deployment of Firefox send temporary file sharing service using Tencent cloud

Then we install it

Switch userssu send

Execute in the source foldernpm install

use:npm run buildCompile the production environment.

Last runnpm run prod

The access address isip:1443Don’t forget to open the port

Domain name access

We can just use the reverse of the pagoda

Add the following to the configuration file:

location /api/ws {

       proxy_redirect off;

       proxy_pass http://0.0.0.0:1443;

       proxy_http_version 1.1;

       proxy_set_header Upgrade $http_upgrade;

       proxy_set_header Connection "upgrade";

       proxy_set_header Host $http_host;

   }

The proxy / API / WS path is required because the Firefox send file upload uses the websocket protocol

Lightweight deployment of Firefox send temporary file sharing service using Tencent cloud

Configure background startup

After using NPM run prod to start, close SSH and the service will be shut down. We can use screen or PM2 manager to run it in the background

In the pagoda PM2 manager, configure as shown in the figure

Lightweight deployment of Firefox send temporary file sharing service using Tencent cloud

Recommended Today

Online English name random generator

Online English name random generator Online English name random generator The tool supports batch random generation of English names. The maximum number of generated names for all genders is 1000 and the maximum number of specified genders is 500. It can be used for testing and so on. https://tooltt.com/english-name/