Skip to content
vincent.bernat.ch·

🔒SSH Port Forwarding for Local Blog Preview

SSH port forwarding lets you preview localhost blogs remotely

TL;DR

SSH port forwarding allows developers to preview localhost blogs remotely. Tools like ngrok and self-hosted solutions with OpenSSH and nginx offer alternatives. Use a secret hash for security.

SSH port forwarding lets developers preview localhost blogs remotely. This is crucial for collaborative work and testing. For example, the command `ssh -R 0:localhost:8080 http-over-ssh` allocates a free port for remote forwarding. Nginx and OpenSSH are used to secure the setup with a secret hash and expiration timestamp. DNS records and wildcard certificates are also necessary.

SSH Port Forwarding for Local Blog Preview — vincent.bernat.ch

Key Points

1

SSH command `ssh -R 0:localhost:8080 http-over-ssh` allocates a free port for remote forwarding.

2

Nginx config proxies requests from https://p41535.ssh.luffy.cx to http://127.0.0.1:41535.

3

DNS records for *.ssh.luffy.cx and wildcard certificates through Let's Encrypt are required.

4

Secure link module computes hash over secret, expiration timestamp, and port for security.

5

Token generation command `printf '%s %s %s' | openssl md5 -binary | openssl base64 | tr +/ -_ | tr -d =` creates secure hash.

Why It Matters

If you're debugging a localhost blog locally and need a remote preview, SSH port forwarding is essential. Use `ssh -R 0:localhost:8080 http-over-ssh` to allocate a free port. Secure the setup with a secret hash and expiration timestamp. DNS records and wildcard certificates are necessary for a seamless experience.

sshport-forwardingnginxremote-previewblog-preview

Comments

Subscribe to join the conversation...

Be the first to comment

Enjoyed this article?

Get it daily. 7am. Free. Reads in 5 minutes.

Join 3,549 builders reading daily.

Also get