Skip to content
Go back

Building a Website with Lunes Host

Published:  at  11:00 PM
Reads: 0

About Lunes Host

I explained it in this post.

This is a server with extremely limited resources and a very inconvenient operating experience. So what can it be used for?

With a tunnel from our favorite cyber philanthropist, Cloudflare, you can easily deploy a small website.

Choosing the Service

Because the machine is genuinely tiny, I chose to use Python to run the simplest static website.

So when creating the machine, choose Python as the software.

Installing the Tunnel

In Cloudflare Zero Trust, go to Networks > Connectors > Create a tunnel.

After creating it, Cloudflare will give you a command for installing cloudflared.

Copy the command first. We will need the token inside it.

Go back to the machine’s command line.

If you find that the machine cannot start, go to Startup first and change the startup command to bash.

Run the following two commands.

# Download to the current user's directory and name it cloudflared
curl -L -o ./cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64

# Give it execute permission
chmod +x ./cloudflared

Then create a script in the file manager and name it cf.sh. The content is as follows. Replace the XXX part with the token mentioned above.

nohup ./cloudflared tunnel run --token XXX < /dev/null > cloudflared.log 2>&1 &
bash

Then change the startup command in Startup to bash cf.sh, and restart the machine.

Go back to Cloudflare, and you should see that the tunnel has been created successfully. Then move on to the next step.

This step requires filling in your domain information and the service you want to bind.

Fill in the domain information according to your own situation.

For the service to bind below, I recommend choosing http instead of https, because static pages started with Python use http by default, and setting up https has some performance requirements.

After http, enter localhost

. XXXX is the port number you choose yourself, and it does not have to match the one provided by the system.

At this point, the tunnel setup is complete.

Deploying the Website

First, upload your entire website.

Then open the cf.sh script used earlier and add the following line at the very beginning.

nohup python3 -m http.server XXXX --directory /path/to/your/static/files < /dev/null > python.log 2>&1 &

Make sure the port number matches the one you entered in Cloudflare.

Then restart the machine.

If nothing goes wrong, your website should now be accessible through your domain.

Afterword

Someone may ask: isn’t this worse than just using Cloudflare Pages?

Actually, I just wanted to share that this thing can be used with tunnels.

What exactly you use it for is up to your imagination.


Share this post on:

Next Post
Ad Alliance Recommendations