banner
槿呈Goidea

槿呈Goidea

读书|新知|生活禅
twitter
tg_channel
youtube

Sharing site/website monitoring/memos/uPic&Cloudflare R2/MTPROTO

I have been tinkering with VPS these past few days. First, I migrated some of the sites and services that were still hosted on Tencent Cloud Light to 10g.biz. I highly recommend this VPS provider as it offers optimized routes, fast speed, and stability.

First, I created a sharing site (file.hhzz.love) so that I can directly upload and share content (such as videos and files) when writing blog posts and newsletters.

image

Setting up this sharing site is very simple. First, create a new website in the control panel and set up DNS resolution and SSL certificates. Then, install fileinfo and exif in the PHP environment. Finally, upload the index.php file downloaded from the File Gallery official website to the website's file directory.

The index.php file can be modified at any time. Here are some commonly used parameters for reference:

// Root directory configuration
    'root' => '',    // Relative or absolute path, leave blank for current directory, no need for / symbol for subdirectories
    'start_path' => false,    // The first directory to be loaded into the view, by default, this directory is the same as the root directory

// Authorization login
    'username' => '',    // User account (leave blank to disable)
    'password' => '',    // User password (leave blank to disable)

// Exclude files or directories
    'files_exclude' => '',    // '/\.(png|jpe?g)$/i'   / Explanation: exclude file extensions png, jpeg, jpg
    'dirs_exclude' => '',    // '/\/AAA|\/doc|\/222(\/|$)/i'    / Explanation: exclude directories AAA, doc, 222

// Menu
    'menu_enabled' => true    // Enable or disable the left folder menu
    'menu_show' => true    // Expand or collapse the folder menu
    'menu_sort' => 'name_asc'    // Sort the left folder menu    / name_asc, name_desc, date_asc, date_desc

// Layout
    'layout' => 'rows'    // Layout of the main view area, including options: list, block, grid, rows, and columns
    'sort' => 'name_asc'    // Default sorting of the main view area    / name_asc, name_desc, date_asc, date_desc

2. Website Status

After that, I came across the uptime-status project on GitHub, which can monitor the running status of deployed websites.

image

This project uses the API of UptimeRobot, so you need to register on their website first. Free users can monitor up to 50 websites, which is sufficient for most people.

Step 1: After registration, click "+ Add New Monitor" and select "HTTP(s)" as the monitor type. Fill in the website name and domain name.

image

image

Step 2: After adding the websites to be monitored, move the mouse to the user email, select "My Settings", and find "API Settings". In "Monitor-Specific API Keys", select "Show/hide it" and then enter the website name you just added in the search bar to get the API Key.

image

image

Step 3: Create a new website in the control panel, set up DNS resolution and SSL certificates. Then, upload and unzip the uptime-status.zip file downloaded from uptime-status to the website directory.

Step 4: Modify the config.js file:

  • SiteName: The name of the website to be displayed
  • ApiKeys: The API Key obtained in Step 2
  • CountDays: The number of days of logs to be displayed, recommended values are 60 or 90
  • ShowLink: Whether to display the website link
  • Navi: Menu list for the navigation bar

3. Memos

Flomo is a great app that many people praise. However, due to its limitations in output and organization, it has not been integrated into my workflow. So why did I deploy memos?

First, I think there is a lot of content that doesn't necessarily need to be written in a blog post but still needs to be shared.

Second, I used Montaigne before (see: Turning Memos into a Blog with Montaigne) to write directly in Apple's Notes app. But recently, I found that I shared a few notes with Zeze and friends, and it was easy to confuse them with Montaigne.

Therefore, I deployed an open-source project called memos, which is a high-fidelity imitation of flomo.

image

Compared to flomo, I think memos has the advantage of being open-source and self-hosted. It also has third-party apps developed for iOS and macOS. In addition, there are many interesting ways to use it, including not only the conventional ones like Shortcuts and Raycast Extension, but also deploying it as a static showcase site and a static image site.

It is very convenient to deploy memos using Docker. Connect to the server via SSH and enter the following code:

docker run -d --name memos -p 5230:5230 -v ~/.memos/:/var/opt/memos ghcr.io/usememos/memos:latest

Then, create a website in the control panel and set up reverse proxy http://127.0.0.1:5230 $host in the website settings.

4. Cloudflare R2

Today, I noticed that Cloudflare's object storage R2 can now be set to public access. This means that I can store the data of the memos site in R2 and use it as an image hosting service in uPic.

I have been using Tencent Cloud COS, and compared to R2, the price advantage seems not significant. However, compared to AWS S3, R2 has a clear price advantage. You can see the detailed comparison in this article.

Cloudflare R2Tencent Cloud COS
Standard storage costFree for the first 10GB per month, $0.015/GB/month for exceedingFree for the first 10GB per month, different charges for different storage types and regions for exceeding
Request costFree for the first 10 million requests per month, $4.50/million requests for A-class operations, $0.36/million requests for B-class operations for exceedingFree for the first 10 million requests per month, different charges for exceeding based on different request types and regions
Download traffic costNoneFree for the first 10GB per month, different charges for exceeding based on different regions and traffic types
Upload traffic costNoneFree for the first 10GB per month, different charges for exceeding based on different regions and traffic types
Resource package deductionNoneAvailable

Although R2 currently does not have a significant price advantage compared to Tencent Cloud COS, the free quota of 10GB per month is still good. I won't go into the details of the registration process and obtaining the R2 API token.

Since R2 is compatible with S3, you can directly add Amazon S3 in the image hosting options in uPic, and then select custom. Fill in the server URL in the format of https://xxx.r2.cloudflarestorage.com/yourbucketname, which can be found below the bucket name. The space name is the name of the bucket, and the Access Key and Secret Key are the Access Key ID and Secret Access Key in the R2 API token. The domain name is the custom bucket domain.

image

After filling in the information, click "Verify". uPic will automatically upload an image. If you see the image file in R2, it means the configuration is successful. Click "Save" and you can start using it.

5. MTPROTO

Recently, I needed to pay attention to some information on Tg, but I didn't want to keep Surge running on my phone all the time. So I deployed MTPROTO using Sunpma's one-click script on VPS.

## Create a directory
mkdir /home/mtproxy && cd /home/mtproxy

## Start installation
curl -s -o mtproxy.sh https://raw.githubusercontent.com/sunpma/mtp/master/mtproxy.sh && chmod +x mtproxy.sh && bash mtproxy.sh
## Run the service
bash mtproxy.sh start

## Run in debug mode
bash mtproxy.sh debug

## Stop the service
bash mtproxy.sh stop

## Restart the service
bash mtproxy.sh restart

## Uninstall with one click
rm -rf /home/mtproxy
## Start on boot
chmod 755 /home/mtproxy/mtproxy.sh

vi /etc/crontab

## Add the following command and save

@reboot root nohup bash /home/mtproxy/mtproxy.sh start > /dev/null 2>&1 &
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.