banner
L,.G

L,.G

读书|新知|生活禅

Deploying Node.js version of TiddlyWiki on a VPS

DALL-EDigitalWorkspace

Deploying Node.js version of TiddlyWiki is not complicated. However, some preparation work needs to be done before deployment.

Preparation#

  1. Prepare a VPS and install BT Panel.
  2. Install PM2 on the VPS.
  3. Prepare a domain name.

Step 1: Install TiddlyWiki#

After completing the preparation work, you can start installing TiddlyWiki on the VPS.

First, log in to the VPS via SSH.

Then enter sudo npm install -g tiddlywiki to perform a global installation.

Step 2: Create a website#

Open the BT Panel backend on the VPS, click "Website" on the left side of the BT Panel, create a new website, enter your domain name (which will be used to access TiddlyWiki in the future), and configure the rest as follows:

img

Step 3: Deploy TiddlyWiki service#

First, enter cd /www/wwwroot/your_domain in SSH.

Then enter tiddlywiki mywiki –init server.

This will create a mywiki folder in /www/wwwroot/your_domain and deploy TiddlyWiki.

Step 4: Configure PM2 manager#

First, enter cd /www/wwwroot/your_domain/mywiki in SSH.

Then enter pm2 start "tiddlywiki --server".

At this point, you can enter pm2 list to check if the TiddlyWiki server is running properly.

Then enter pm2 startup and pm2 save in sequence.

Step 5: Configure firewall and reverse proxy#

First, allow port 8080 in the security settings of the BT Panel.

img

Then, configure reverse proxy in the website settings.

img

In addition, domain name certificates need to be configured.

More secure access#

At this point, you can open your TiddlyWiki using the domain name and start taking notes.

However, at this point, anyone can open your TiddlyWiki using the domain name, which is not secure.

To deploy it more securely, there are two ways: the first way is to only allow yourself to open TiddlyWiki, and the second way is to allow everyone to open it but only you can edit it.

Way 1#

Keep other deployment steps unchanged and only modify "Step 4: Configure PM2 manager".

First, enter cd /www/wwwroot/your_domain/mywiki in SSH.

Then enter pm2 start tiddlywiki --name "mywiki" -- --listen host=127.0.0.1 port=8080 username=username password=password.

At this point, you can enter pm2 list to check if the TiddlyWiki server is running properly.

Then enter pm2 startup and pm2 save in sequence.

This way, you can only access your TiddlyWiki by entering the username and password, which improves security.

Way 2#

Open the BT Panel, create a new file in the root directory of the website (/www/wwwroot/your_domain) and name it start-wiki.sh. Then enter the following content in the file:

 #!/bin/bash
 tiddlywiki /www/wwwroot/your_domain/mywiki/ --listen host=127.0.0.1 port=8080 "readers=(anon)" writers=your_username username=your_username password=your_password

Here, your_username and your_password need to be modified to your own username and password.

Next, keep other steps unchanged and only modify "Step 4: Configure PM2 manager".

First, enter chmod +x /www/wwwroot/your_domain/start-wiki.sh in SSH to add execute permission to start-wiki.sh.

Then enter pm2 start /www/wwwroot/your_domain/start-wiki.sh --name "tiddlywiki".

At this point, you can enter pm2 list to check if the TiddlyWiki server is running properly.

Then enter pm2 startup and pm2 save in sequence.

After that, you can access your TiddlyWiki using https://your_domain/login-basic as an administrator, while other visitors can access it normally but cannot modify your note content and configuration.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.