Skip to main content

Enable Tailscale serve on a Linux Machine

·234 words·2 mins
Thorsten Lenzen
Author
Thorsten Lenzen
Coding, Devops and Homelab maniac…

1. Install a tailscale self signed certificate
#

sudo tailscale cert [ts-hostname].[ts-domain]

# or im my case

sudo tailscale cert codeserver.snares-stairs.ts.net

tailscale cert: This tells Tailscale to reach out to Let’s Encrypt (a free certificate authority) and generate a security certificate for your specific machine.

2. Enable the Tailscale Reverse Proxy
#

Tailscale has a built-in feature called serve that acts as a reverse proxy. This automatically handles SSL encryption (HTTPS) for you, so you don’t have to manually manage certificate files.

Run the following command (replace 8080 if you used a different port):

sudo tailscale serve --bg --https=443 8080

What this does:

  • sudo tailscale serve: Tells Tailscale to listen for incoming web traffic.
  • **--bg: The task run in the background and will be restarted upon reboot.
  • --https=443: Switches on encryption and uses the standard web port for HTTPS.
  • 8080: Directs that traffic to your local code-server instance.

3. Verify the Status
#

To make sure the proxy is active and pointing to the right place, check the status:

tailscale serve status

You should see an output similar to this:

[https://codeserver.snares-stairs.ts.net](https://codeserver.snares-stairs.ts.net) (tailnet only)
|-- / proxy [http://127.0.0.1:8080](http://127.0.0.1:8080)

Key Advantages of this Setup:

  1. Security: Your code-server is now only accessible via your private Tailnet.
  2. Encryption: Traffic is fully encrypted, protecting your password and code.
  3. No Port Mess: You no longer need to type :8080 at the end of the URL; just use the domain name.