<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Jamie Lab</title>
    <description>Experiments. Networks. Homelab. Code.</description>
    <link>https://jamielab.me/</link>
    <atom:link href="https://jamielab.me/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sun, 06 Dec 2026 05:40:30 +0000</pubDate>
    <lastBuildDate>Sun, 06 Dec 2026 05:40:30 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>Tailscale vs WireGuard vs Cloudflare Tunnel for Homelabs</title>
        <description>&lt;p&gt;You’ve got a Raspberry Pi running Pi-hole, a password manager, maybe a media server. Now you want to reach all of it from a coffee shop, a hotel, or your phone on cellular, without punching holes in your router.&lt;/p&gt;

&lt;p&gt;Three tools come up in almost every answer: &lt;strong&gt;Tailscale&lt;/strong&gt;, &lt;strong&gt;WireGuard&lt;/strong&gt;, and &lt;strong&gt;Cloudflare Tunnel&lt;/strong&gt;. They sound interchangeable, but they solve two different problems. This guide explains the difference, compares them side by side, and shows how to get the most common setup running in a few commands.&lt;/p&gt;

&lt;h2 id=&quot;the-short-answer&quot;&gt;The Short Answer&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Only you (and a few people you trust) need access:&lt;/strong&gt; use &lt;strong&gt;Tailscale&lt;/strong&gt;. It is the lowest-effort path to a private network.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;You want full control and no third-party coordination server:&lt;/strong&gt; use &lt;strong&gt;plain WireGuard&lt;/strong&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;You want to publish a service at a public URL&lt;/strong&gt; (for family, a webhook, a demo): use &lt;strong&gt;Cloudflare Tunnel&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Many homelabs end up running two of the three: a private VPN for admin access and a tunnel for the one or two services that need a public address.&lt;/p&gt;

&lt;h2 id=&quot;private-network-vs-public-exposure&quot;&gt;Private Network vs Public Exposure&lt;/h2&gt;

&lt;p&gt;This is the distinction most comparisons skip, and it decides everything else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tailscale and WireGuard build a private network.&lt;/strong&gt; Only devices you enroll can reach your services. Nothing is visible to the public internet, so there is nothing to scan or brute-force.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cloudflare Tunnel publishes a service.&lt;/strong&gt; It gives a service a public HTTPS hostname through Cloudflare’s edge, with no inbound port open on your router. You are still exposing the app to the internet, so the app’s own authentication has to be solid.&lt;/p&gt;

&lt;p&gt;If you are only trying to SSH into your Pi or open an admin dashboard, you almost certainly want a private network rather than a public hostname.&lt;/p&gt;

&lt;h2 id=&quot;tailscale-the-easy-mesh-vpn&quot;&gt;Tailscale: The Easy Mesh VPN&lt;/h2&gt;

&lt;p&gt;Tailscale is a managed mesh VPN built on WireGuard. You install it on each device, sign in, and the devices can reach each other by stable private addresses. NAT traversal, key exchange, and DNS are handled for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good fit when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Your ISP uses CGNAT, so you can’t forward ports even if you wanted to&lt;/li&gt;
  &lt;li&gt;You have phones and laptops that roam between networks&lt;/li&gt;
  &lt;li&gt;You want to reach a whole LAN through one device (a &lt;em&gt;subnet router&lt;/em&gt;) without installing anything on every machine&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Trade-offs:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;A third-party coordination service manages authentication and key distribution (your traffic itself is encrypted between devices)&lt;/li&gt;
  &lt;li&gt;Free-tier limits and terms can change, so check the current plan before you rely on it&lt;/li&gt;
  &lt;li&gt;You can self-host the control server with the open-source Headscale project, at the cost of doing more work yourself&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;quick-start-on-a-raspberry-pi&quot;&gt;Quick Start on a Raspberry Pi&lt;/h3&gt;

&lt;p&gt;Install Tailscale and bring the node up:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl &lt;span class=&quot;nt&quot;&gt;-fsSL&lt;/span&gt; https://tailscale.com/install.sh | sh
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;tailscale up
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To reach other devices on your home network through the Pi, enable IP forwarding and advertise your subnet:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;net.ipv4.ip_forward = 1&apos;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sudo tee&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; /etc/sysctl.d/99-tailscale.conf
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;sysctl &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /etc/sysctl.d/99-tailscale.conf

&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;tailscale up &lt;span class=&quot;nt&quot;&gt;--advertise-routes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;192.168.1.0/24
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then approve the route in the Tailscale admin console. The full walkthrough, including ACLs and troubleshooting, is in my &lt;a href=&quot;/notes/tailscale-subnet-routing/&quot;&gt;Tailscale subnet routing note&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For a deeper reference, see the official &lt;a href=&quot;https://tailscale.com/kb/1019/subnets/&quot;&gt;Tailscale subnet router documentation&lt;/a&gt; and the &lt;a href=&quot;https://tailscale.com/kb/1103/exit-nodes/&quot;&gt;exit node guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;wireguard-maximum-control&quot;&gt;WireGuard: Maximum Control&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.wireguard.com/&quot;&gt;WireGuard&lt;/a&gt; is the protocol underneath Tailscale. Running it yourself means a small, fast, auditable VPN with no outside service involved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good fit when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;You want everything self-hosted and self-managed&lt;/li&gt;
  &lt;li&gt;You have a public IP or a dynamic DNS name and can forward one UDP port&lt;/li&gt;
  &lt;li&gt;You only have a handful of devices&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Trade-offs:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;You generate and distribute keys by hand&lt;/li&gt;
  &lt;li&gt;You configure each peer, its &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AllowedIPs&lt;/code&gt;, DNS, and firewall rules yourself&lt;/li&gt;
  &lt;li&gt;It needs one reachable endpoint, which is a problem behind CGNAT unless you rent a small VPS to act as the hub&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A minimal server config looks like this:&lt;/p&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;[Interface]&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;Address&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;10.8.0.1/24&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;ListenPort&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;51820&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;PrivateKey&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;lt;server-private-key&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nn&quot;&gt;[Peer]&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# Laptop
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;PublicKey&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;lt;laptop-public-key&amp;gt;&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;AllowedIPs&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;10.8.0.2/32&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Open the port and bring it up:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw allow 51820/udp
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;wg-quick up wg0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you go this route, lock the host down first. My &lt;a href=&quot;/blog/2025/12/24/setting-up-ufw-rules/&quot;&gt;UFW rules guide&lt;/a&gt; covers a sensible baseline.&lt;/p&gt;

&lt;h2 id=&quot;cloudflare-tunnel-publish-without-opening-ports&quot;&gt;Cloudflare Tunnel: Publish Without Opening Ports&lt;/h2&gt;

&lt;p&gt;Cloudflare Tunnel runs a small daemon, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cloudflared&lt;/code&gt;, on your server. It makes an &lt;em&gt;outbound&lt;/em&gt; connection to Cloudflare, which then routes public requests for your hostname back through it. Your router never needs an open inbound port.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good fit when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;You want a real HTTPS URL for a service, such as a status page or a shared app&lt;/li&gt;
  &lt;li&gt;You already manage your domain’s DNS in Cloudflare&lt;/li&gt;
  &lt;li&gt;You want Cloudflare’s edge in front of the service&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Trade-offs:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The service is reachable from the public internet, so it needs strong authentication (Cloudflare Access can add a login in front)&lt;/li&gt;
  &lt;li&gt;Traffic passes through Cloudflare’s network&lt;/li&gt;
  &lt;li&gt;Cloudflare’s terms limit some uses, such as proxying large media streams, so read the current terms before putting a media server behind it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The setup flow is: install &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cloudflared&lt;/code&gt;, authenticate it, create a named tunnel, and map a hostname to a local service. The &lt;a href=&quot;https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/&quot;&gt;Cloudflare Tunnel documentation&lt;/a&gt; walks through each step.&lt;/p&gt;

&lt;h2 id=&quot;side-by-side-comparison&quot;&gt;Side-by-Side Comparison&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;&lt;strong&gt;Tailscale&lt;/strong&gt;&lt;/th&gt;
      &lt;th&gt;&lt;strong&gt;WireGuard&lt;/strong&gt;&lt;/th&gt;
      &lt;th&gt;&lt;strong&gt;Cloudflare Tunnel&lt;/strong&gt;&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Model&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Private mesh VPN&lt;/td&gt;
      &lt;td&gt;Private VPN (DIY)&lt;/td&gt;
      &lt;td&gt;Public hostname via Cloudflare&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Setup effort&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Low&lt;/td&gt;
      &lt;td&gt;Medium to high&lt;/td&gt;
      &lt;td&gt;Medium&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Works behind CGNAT&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Yes&lt;/td&gt;
      &lt;td&gt;Only with a public relay&lt;/td&gt;
      &lt;td&gt;Yes&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Needs open router port&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;No&lt;/td&gt;
      &lt;td&gt;Yes (one UDP port)&lt;/td&gt;
      &lt;td&gt;No&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Third-party dependency&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Coordination server&lt;/td&gt;
      &lt;td&gt;None&lt;/td&gt;
      &lt;td&gt;Cloudflare edge&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Exposed to the internet&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;No&lt;/td&gt;
      &lt;td&gt;No (one UDP port)&lt;/td&gt;
      &lt;td&gt;Yes, by design&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Best for&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Admin access, roaming devices&lt;/td&gt;
      &lt;td&gt;Full control, small setups&lt;/td&gt;
      &lt;td&gt;Sharing a service publicly&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;which-one-should-you-pick&quot;&gt;Which One Should You Pick?&lt;/h2&gt;

&lt;p&gt;Work through these questions in order:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Does anyone outside your own devices need access?&lt;/strong&gt; If yes, and they shouldn’t install anything, Cloudflare Tunnel (with Access in front) is the practical choice.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Are you behind CGNAT or without a static IP?&lt;/strong&gt; If yes, skip plain WireGuard unless you are willing to run a relay. Choose Tailscale.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Do you want zero third-party involvement?&lt;/strong&gt; Choose WireGuard, or Tailscale with Headscale if you want the convenience layer.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Everything else:&lt;/strong&gt; start with Tailscale. You can add the others later.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Whichever you choose, pair it with a solid backup plan for the services you are reaching. If you host your own password vault, see my write-up on &lt;a href=&quot;/blog/2026/01/18/vaultwarden-backup-solution/&quot;&gt;self-hosting Vaultwarden with a disaster-recovery fallback&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;faq&quot;&gt;FAQ&lt;/h2&gt;

&lt;h3 id=&quot;is-tailscale-just-wireguard&quot;&gt;Is Tailscale just WireGuard?&lt;/h3&gt;

&lt;p&gt;Tailscale uses WireGuard for the encrypted tunnels, then adds the parts that are tedious to do by hand: key distribution, NAT traversal, device identity, and DNS. You get WireGuard’s performance without managing configs for every peer.&lt;/p&gt;

&lt;h3 id=&quot;do-i-need-to-forward-ports-for-tailscale&quot;&gt;Do I need to forward ports for Tailscale?&lt;/h3&gt;

&lt;p&gt;No. Tailscale devices connect outbound and negotiate a direct path when possible, falling back to a relay when a direct connection can’t be made. That is why it works behind CGNAT and strict routers.&lt;/p&gt;

&lt;h3 id=&quot;is-cloudflare-tunnel-safer-than-opening-a-port&quot;&gt;Is Cloudflare Tunnel safer than opening a port?&lt;/h3&gt;

&lt;p&gt;It removes the open inbound port, which cuts down on scanning and direct attacks against your router. But the service is still public, so a weak login page is still a weak login page. Add authentication such as Cloudflare Access, and keep the app updated.&lt;/p&gt;

&lt;h3 id=&quot;can-i-use-tailscale-and-cloudflare-tunnel-together&quot;&gt;Can I use Tailscale and Cloudflare Tunnel together?&lt;/h3&gt;

&lt;p&gt;Yes, and it is a common pattern. Use Tailscale for private admin access (SSH, dashboards, Pi-hole) and Cloudflare Tunnel for the small number of services that need a public URL.&lt;/p&gt;

&lt;h3 id=&quot;which-is-fastest&quot;&gt;Which is fastest?&lt;/h3&gt;

&lt;p&gt;Raw throughput is close, since Tailscale runs WireGuard underneath. When Tailscale establishes a direct peer-to-peer connection, performance is comparable to hand-configured WireGuard. Relayed connections are slower, so a CPU-limited Pi or a distant relay will matter more than the tool you choose.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;For most homelabs, &lt;strong&gt;Tailscale is the right starting point&lt;/strong&gt;: private by default, no port forwarding, and working in minutes. Reach for &lt;strong&gt;WireGuard&lt;/strong&gt; when you want to own every piece, and add &lt;strong&gt;Cloudflare Tunnel&lt;/strong&gt; only for services that truly need a public address.&lt;/p&gt;

&lt;p&gt;If you’re setting up your first remote-access path, follow the &lt;a href=&quot;/notes/tailscale-subnet-routing/&quot;&gt;Tailscale subnet routing note&lt;/a&gt; and then read through my &lt;a href=&quot;/homelab/&quot;&gt;homelab page&lt;/a&gt; to see how the pieces fit together.&lt;/p&gt;

&lt;script type=&quot;application/ld+json&quot;&gt;
{
  &quot;@context&quot;: &quot;https://schema.org&quot;,
  &quot;@type&quot;: &quot;FAQPage&quot;,
  &quot;mainEntity&quot;: [
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Is Tailscale just WireGuard?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;Tailscale uses WireGuard for the encrypted tunnels, then adds key distribution, NAT traversal, device identity, and DNS so you do not have to configure every peer by hand.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Do I need to forward ports for Tailscale?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;No. Tailscale devices connect outbound and negotiate a direct path when possible, falling back to a relay when needed, so it works behind CGNAT and strict routers.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Is Cloudflare Tunnel safer than opening a port?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;It removes the open inbound port, but the service is still public. Add authentication such as Cloudflare Access and keep the app updated.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Can I use Tailscale and Cloudflare Tunnel together?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;Yes. Use Tailscale for private admin access and Cloudflare Tunnel for the few services that need a public URL.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Which is fastest?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;Raw throughput is close because Tailscale runs WireGuard underneath. Direct Tailscale connections perform comparably to hand-configured WireGuard, while relayed connections are slower.&quot;
      }
    }
  ]
}
&lt;/script&gt;

</description>
        <pubDate>Sun, 04 Oct 2026 13:00:00 +0000</pubDate>
        <link>https://jamielab.me/blog/2026/10/04/tailscale-vs-wireguard-vs-cloudflare-tunnel/</link>
        <guid isPermaLink="true">https://jamielab.me/blog/2026/10/04/tailscale-vs-wireguard-vs-cloudflare-tunnel/</guid>
        
        <category>homelab</category>
        
        <category>networking</category>
        
        <category>self-hosting</category>
        
      </item>
    
      <item>
        <title>Setting up a reverse proxy</title>
        <description>&lt;h2 id=&quot;what-is-a-reverse-proxy&quot;&gt;What is a Reverse Proxy?&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;reverse proxy&lt;/strong&gt; sits in front of one or more web servers (the &lt;em&gt;backend&lt;/em&gt;).&lt;br /&gt;
When a client sends an HTTP request, the reverse proxy receives it and forwards
the request to the appropriate backend server.  The response then flows back
through the proxy to the client.&lt;/p&gt;

&lt;p&gt;Typical use‑cases&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Use case&lt;/th&gt;
      &lt;th&gt;Why you’d use a reverse proxy&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Load balancing&lt;/strong&gt; – distribute traffic across several identical services.&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;SSL termination&lt;/strong&gt; – terminate TLS at the proxy and forward plain HTTP downstream.&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Security / WAF&lt;/strong&gt; – filter or block malicious requests before they hit your app.&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;URL rewriting / path routing&lt;/strong&gt; – expose many services under a single domain.&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Caching / compression&lt;/strong&gt; – reduce load on back‑ends.&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Micro‑services gateway&lt;/strong&gt; – route requests to the right service by host/path.&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Below you’ll find step‑by‑step instructions for three popular reverse proxy stacks:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Nginx&lt;/strong&gt; (lightweight, widely used)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Apache HTTP Server&lt;/strong&gt; with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mod_proxy&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Traefik&lt;/strong&gt; (dynamic, micro‑service friendly)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Feel free to pick the one that best fits your environment and skill set.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;1-nginx-reverse-proxy&quot;&gt;1. NGINX Reverse Proxy&lt;/h2&gt;

&lt;h3 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;A Linux server (Ubuntu/Debian/RedHat/CentOS) with root or sudo access.&lt;/li&gt;
  &lt;li&gt;Backend application running on a port, e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://localhost:3000&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;installation&quot;&gt;Installation&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Debian / Ubuntu&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt update
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;nginx &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# CentOS / RHEL (EPEL)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;yum &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;epel-release &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;yum &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;nginx &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;basic-configuration&quot;&gt;Basic Configuration&lt;/h3&gt;

&lt;p&gt;Create a new server block in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/nginx/sites-available/example.com&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;example.com&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;www.example.com&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Optional: redirect HTTP → HTTPS (see SSL section)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# return 301 https://$host$request_uri;&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;proxy_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;http://localhost:3000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;          &lt;span class=&quot;c1&quot;&gt;# Backend URL&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Host&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;              &lt;span class=&quot;c1&quot;&gt;# Preserve original host header&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;X-Real-IP&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$remote_addr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Forward client IP&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;X-Forwarded-For&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$proxy_add_x_forwarded_for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;X-Forwarded-Proto&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$scheme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;# Static files (optional)&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/static/&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;alias&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/example.com/static/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;expires&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;add_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Cache-Control&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Enable the site and reload Nginx:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;nginx &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt;   &lt;span class=&quot;c&quot;&gt;# Test config syntax&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl reload nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;ssltls-lets-encrypt&quot;&gt;SSL/TLS (Let’s Encrypt)&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Install Certbot&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;certbot python3-certbot-nginx &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Obtain a certificate and automatically configure Nginx&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;certbot &lt;span class=&quot;nt&quot;&gt;--nginx&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; example.com &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; www.example.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Certbot will modify the server block to listen on port 443, add the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssl_*&lt;/code&gt; directives, and set up auto‑renewal.&lt;/p&gt;

&lt;h3 id=&quot;advanced-options&quot;&gt;Advanced Options&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Feature&lt;/th&gt;
      &lt;th&gt;Configuration&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Load balancing&lt;/strong&gt; (multiple backends)&lt;/td&gt;
      &lt;td&gt;Use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;upstream&lt;/code&gt; directive.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;WebSocket support&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection &quot;upgrade&quot;;&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Health checks&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;Third‑party modules or external scripts.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Rate limiting / DDoS protection&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;limit_req_zone&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;limit_conn_zone&lt;/code&gt;.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;2-apache-http-server-reverse-proxy&quot;&gt;2. Apache HTTP Server Reverse Proxy&lt;/h2&gt;

&lt;h3 id=&quot;prerequisites-1&quot;&gt;Prerequisites&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Apache installed (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apache2&lt;/code&gt; on Debian/Ubuntu, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;httpd&lt;/code&gt; on CentOS/RHEL).&lt;/li&gt;
  &lt;li&gt;Backend application listening on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost:3000&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;enable-modules&quot;&gt;Enable Modules&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Debian / Ubuntu&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;a2enmod proxy
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;a2enmod proxy_http
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;a2enmod headers   &lt;span class=&quot;c&quot;&gt;# optional but recommended&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl restart apache2

&lt;span class=&quot;c&quot;&gt;# CentOS / RHEL&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;yum &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;httpd &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl start httpd
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;virtual-host-configuration&quot;&gt;Virtual Host Configuration&lt;/h3&gt;

&lt;p&gt;Create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/apache2/sites-available/example.com.conf&lt;/code&gt; (Debian) or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/httpd/conf.d/example.com.conf&lt;/code&gt; (CentOS):&lt;/p&gt;

&lt;div class=&quot;language-apache highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;VirtualHost&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt; *:80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;
&lt;/span&gt;    &lt;span class=&quot;nc&quot;&gt;ServerName&lt;/span&gt; example.com
    &lt;span class=&quot;nc&quot;&gt;ServerAlias&lt;/span&gt; www.example.com

    &lt;span class=&quot;c&quot;&gt;# Proxy settings&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ProxyPreserveHost&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;On&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;ProxyPass&lt;/span&gt; / http://localhost:3000/
    &lt;span class=&quot;nc&quot;&gt;ProxyPassReverse&lt;/span&gt; / http://localhost:3000/

    &lt;span class=&quot;c&quot;&gt;# Optional headers for client IP&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;RequestHeader&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;set&lt;/span&gt; X-Forwarded-Proto &quot;expr=%{REQUEST_SCHEME}&quot;
    &lt;span class=&quot;nc&quot;&gt;RequestHeader&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;set&lt;/span&gt; X-Real-IP expr=%{REMOTE_ADDR}
&lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;VirtualHost&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Enable the site (Debian) and reload:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Debian / Ubuntu&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;a2ensite example.com.conf
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl reload apache2

&lt;span class=&quot;c&quot;&gt;# CentOS / RHEL – just restart httpd&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl reload httpd
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;ssltls-with-lets-encrypt&quot;&gt;SSL/TLS with Let’s Encrypt&lt;/h3&gt;

&lt;p&gt;Same as Nginx: use Certbot with the Apache plugin.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;certbot python3-certbot-apache &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;certbot &lt;span class=&quot;nt&quot;&gt;--apache&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; example.com &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; www.example.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;3-traefik--dynamic-reverse-proxy-for-microservices&quot;&gt;3. TRAEFIK – Dynamic Reverse Proxy for Micro‑services&lt;/h2&gt;

&lt;p&gt;Traefik shines when you have many services that start/stop dynamically (Docker, Kubernetes, etc.).&lt;br /&gt;
It auto‑discovers containers and configures routing without manual edits.&lt;/p&gt;

&lt;h3 id=&quot;prerequisites-2&quot;&gt;Prerequisites&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Docker (or any container runtime).&lt;/li&gt;
  &lt;li&gt;At least one backend service exposing a port (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;node:3000&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;quick-start-with-docker-compose&quot;&gt;Quick Start with Docker Compose&lt;/h3&gt;

&lt;p&gt;Create &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker-compose.yml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;3.8&apos;&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;traefik&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;traefik:v2.10&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;--api.insecure=true&quot;&lt;/span&gt;          &lt;span class=&quot;c1&quot;&gt;# Dashboard (disable in prod)&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;--providers.docker&quot;&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;--entrypoints.web.address=:80&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;ports&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;80:80&quot;&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;8080:8080&quot;&lt;/span&gt;                    &lt;span class=&quot;c1&quot;&gt;# Traefik dashboard&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;volumes&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/var/run/docker.sock:/var/run/docker.sock:ro&quot;&lt;/span&gt;

  &lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;node:18-alpine&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;node&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;server.js&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;# Your app entrypoint&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;expose&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;3000&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;labels&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;traefik.enable=true&quot;&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;traefik.http.routers.app.rule=Host(`example.com`)&quot;&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;traefik.http.services.app.loadbalancer.server.port=3000&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Run:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker compose up &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Traefik will automatically route &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://example.com/&lt;/code&gt; to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;app&lt;/code&gt; container’s port 3000.&lt;br /&gt;
Visit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://localhost:8080/dashboard/&lt;/code&gt; for the UI.&lt;/p&gt;

&lt;h3 id=&quot;adding-tls&quot;&gt;Adding TLS&lt;/h3&gt;

&lt;p&gt;Add Docker labels or a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;traefik.yml&lt;/code&gt; config that uses Let’s Encrypt:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;traefik.http.routers.app.tls=true&quot;&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;traefik.http.routers.app.tls.certresolver=le&quot;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# In the same compose file, add:&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;certs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;traefik/whoami&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# dummy service for resolver test&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;-tls&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;labels&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;traefik.enable=true&quot;&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;traefik.http.routers.certs.rule=Host(`acme-challenge.example.com`)&quot;&lt;/span&gt;
      &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;traefik.http.services.certs.loadbalancer.server.port=80&quot;&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;# TLS resolver&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;tls-resolver&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;traefik/whoami&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;-tls&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;certificates.yml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;tls&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;certificatesResolvers&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;le&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;acme&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;admin@example.com&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;storage&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/acme.json&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;httpChallenge&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;entryPoint&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;web&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Mount &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/acme.json&lt;/code&gt; as a volume and set appropriate permissions.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;common-troubleshooting-tips&quot;&gt;Common Troubleshooting Tips&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Symptom&lt;/th&gt;
      &lt;th&gt;Likely Cause&lt;/th&gt;
      &lt;th&gt;Fix&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;502 Bad Gateway&lt;/td&gt;
      &lt;td&gt;Backend down or wrong port&lt;/td&gt;
      &lt;td&gt;Verify backend is running; check &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;proxy_pass&lt;/code&gt;/&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ProxyPass&lt;/code&gt;.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;No response after HTTPS redirect&lt;/td&gt;
      &lt;td&gt;SSL cert not installed&lt;/td&gt;
      &lt;td&gt;Run Certbot again, or manually configure &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ssl_*&lt;/code&gt; directives.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;IP addresses show as proxy IP&lt;/td&gt;
      &lt;td&gt;Missing headers&lt;/td&gt;
      &lt;td&gt;Add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X-Forwarded-For&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X-Real-IP&lt;/code&gt; (Nginx) or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RequestHeader set X-Real-IP&lt;/code&gt;.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Slow startup after deploying new config&lt;/td&gt;
      &lt;td&gt;Syntax error in config&lt;/td&gt;
      &lt;td&gt;Run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nginx -t&lt;/code&gt; / &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apachectl configtest&lt;/code&gt;.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Port 80 blocked by firewall&lt;/td&gt;
      &lt;td&gt;Firewall rules&lt;/td&gt;
      &lt;td&gt;Allow port 80/443 (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ufw allow http&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;firewall-cmd --add-service=http&lt;/code&gt;).&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;summary-checklist&quot;&gt;Summary Checklist&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Choose your proxy&lt;/strong&gt; (Nginx, Apache, Traefik, etc.).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Install&lt;/strong&gt; the software on a machine that clients can reach.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Configure backend routing&lt;/strong&gt; – point to your app’s IP/port.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Add headers&lt;/strong&gt; to forward client info if needed.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Secure with TLS&lt;/strong&gt; (Let’s Encrypt is free &amp;amp; automated).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Enable logging / monitoring&lt;/strong&gt; – logs in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/nginx/access.log&lt;/code&gt; or Traefik dashboard.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Test&lt;/strong&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl -I http://example.com&lt;/code&gt;, verify headers, SSL certs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once set up, you can expand to load balancing, caching, rate limiting, and even integrate with service meshes. Happy proxying!&lt;/p&gt;
</description>
        <pubDate>Mon, 19 Jan 2026 16:00:00 +0000</pubDate>
        <link>https://jamielab.me/blog/2026/01/19/reverse-proxy-setup/</link>
        <guid isPermaLink="true">https://jamielab.me/blog/2026/01/19/reverse-proxy-setup/</guid>
        
        <category>linux</category>
        
        <category>dev</category>
        
        <category>workflow</category>
        
      </item>
    
      <item>
        <title>Self-Hosting Vaultwarden on a Raspberry Pi (With a Disaster-Recovery Fallback)</title>
        <description>&lt;h2 id=&quot;why-i-self-host-my-password-manager&quot;&gt;Why I Self-Host My Password Manager&lt;/h2&gt;

&lt;p&gt;Password managers sit at the very center of modern digital life. They don’t just store passwords — they store identity, trust, and access. Relying entirely on a third party for that role is convenient, but it also creates a single external point of failure I don’t control.&lt;/p&gt;

&lt;p&gt;This project documents how I self-host Vaultwarden (a lightweight Bitwarden-compatible server) on a Raspberry Pi 5, and how I designed a clean disaster-recovery fallback using a second Pi. The goal wasn’t novelty — it was reliability, security, and recoverability.&lt;/p&gt;

&lt;p&gt;This post doubles as both a guide and a recovery runbook.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;architecture-overview&quot;&gt;Architecture Overview&lt;/h2&gt;

&lt;h3 id=&quot;primary-node-always-on&quot;&gt;Primary Node (Always On)&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Raspberry Pi 5 (headless, Ethernet)&lt;/li&gt;
  &lt;li&gt;Docker + docker-compose&lt;/li&gt;
  &lt;li&gt;Vaultwarden bound to localhost&lt;/li&gt;
  &lt;li&gt;HTTPS enforced via Caddy&lt;/li&gt;
  &lt;li&gt;Local DNS via Pi-hole&lt;/li&gt;
  &lt;li&gt;Persistent data stored outside the container&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;secondary-node-fallback&quot;&gt;Secondary Node (Fallback)&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Raspberry Pi 5 (desktop Pi with 1 TB M.2 SSD)&lt;/li&gt;
  &lt;li&gt;Vaultwarden installed but stopped&lt;/li&gt;
  &lt;li&gt;Receives encrypted backups&lt;/li&gt;
  &lt;li&gt;Can be promoted to primary in minutes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only one Vaultwarden instance runs at a time to avoid database corruption.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;why-vaultwarden&quot;&gt;Why Vaultwarden?&lt;/h2&gt;

&lt;p&gt;Vaultwarden is a community-maintained, Rust-based implementation of the Bitwarden server. Compared to the official server, it is:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Extremely lightweight (ideal for ARM devices)&lt;/li&gt;
  &lt;li&gt;Fully compatible with Bitwarden clients&lt;/li&gt;
  &lt;li&gt;Easier to self-host securely&lt;/li&gt;
  &lt;li&gt;Actively maintained&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For single-user or small homelab use, it’s an excellent fit.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;primary-deployment-headless-pi&quot;&gt;Primary Deployment (Headless Pi)&lt;/h2&gt;

&lt;h3 id=&quot;directory-layout&quot;&gt;Directory Layout&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/opt/vaultwarden/
├── docker-compose.yml
└── data/
    ├── db.sqlite3
    ├── attachments/
    └── config/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Only /opt/vaultwarden/data is backed up. Everything else is reproducible.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;docker-compose-configuration&quot;&gt;Docker Compose Configuration&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;version: &quot;3.8&quot;

services:
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: unless-stopped
    volumes:
      - /opt/vaultwarden/data:/data
    ports:
      - &quot;127.0.0.1:8080:80&quot;
    environment:
      WEBSOCKET_ENABLED: &quot;true&quot;
      ADMIN_TOKEN: &quot;${ADMIN_TOKEN}&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Key decisions:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Vaultwarden is bound to localhost only&lt;/li&gt;
  &lt;li&gt;No direct LAN exposure&lt;/li&gt;
  &lt;li&gt;Secrets live in an .env file&lt;/li&gt;
  &lt;li&gt;Automatic restart after reboot&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;admin-token--hardening&quot;&gt;Admin Token &amp;amp; Hardening&lt;/h3&gt;

&lt;p&gt;Vaultwarden’s admin interface is disabled by default. I explicitly enable it using a strong token:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;openssl rand -base64 48
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This token is required to disable signups and manage security settings.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;https-with-caddy&quot;&gt;HTTPS With Caddy&lt;/h2&gt;

&lt;p&gt;Vaultwarden never handles TLS directly. Caddy acts as the HTTPS front door.&lt;/p&gt;

&lt;h3 id=&quot;caddyfile&quot;&gt;Caddyfile&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vaultwarden.local {
    reverse_proxy 127.0.0.1:8080
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This enforces HTTPS, isolates Vaultwarden from the network, and simplifies future expansion.&lt;/p&gt;

&lt;p&gt;Local DNS (via Pi-hole) maps vaultwarden.local to the Pi’s IP.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;backup-strategy&quot;&gt;Backup Strategy&lt;/h2&gt;

&lt;p&gt;MicroSD cards are convenient — and eventually unreliable. I treat the OS as replaceable and the data as sacred.&lt;/p&gt;

&lt;h3 id=&quot;what-gets-backed-up&quot;&gt;What Gets Backed Up&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/opt/vaultwarden/data/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This includes:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;The SQLite database&lt;/li&gt;
  &lt;li&gt;Attachments&lt;/li&gt;
  &lt;li&gt;Configuration metadata&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No disk images. No container layers.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;manual-backup-rsync&quot;&gt;Manual Backup (rsync)&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rsync -av /opt/vaultwarden/data/ user@desktop-pi:/srv/backups/vaultwarden/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This runs over SSH and is easy to automate later with cron.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;fallback-node-warm-standby&quot;&gt;Fallback Node (Warm Standby)&lt;/h2&gt;

&lt;p&gt;The desktop Pi mirrors the primary configuration but remains offline.&lt;/p&gt;

&lt;h3 id=&quot;fallback-docker-compose&quot;&gt;Fallback Docker Compose&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;version: &quot;3.8&quot;

services:
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: unless-stopped
    volumes:
      - /opt/vaultwarden/data:/data
    ports:
      - &quot;127.0.0.1:8080:80&quot;
    environment:
      WEBSOCKET_ENABLED: &quot;true&quot;
      ADMIN_TOKEN: &quot;${ADMIN_TOKEN}&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Identical configuration means no reconfiguration under stress and no client re-enrollment.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;disaster-recovery-procedure&quot;&gt;Disaster Recovery Procedure&lt;/h2&gt;

&lt;p&gt;If the primary Pi fails:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Restore the latest backup:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rsync -av user@desktop-pi:/srv/backups/vaultwarden/ /opt/vaultwarden/data/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Start Vaultwarden:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd /opt/vaultwarden &amp;amp;&amp;amp; docker-compose up -d
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Update DNS so vaultwarden.local points to the desktop Pi.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Clients reconnect automatically.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Recovery time is measured in minutes.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;why-this-design-works&quot;&gt;Why This Design Works&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;No split-brain risk (single active instance)&lt;/li&gt;
  &lt;li&gt;Fast recovery using SQLite + Docker&lt;/li&gt;
  &lt;li&gt;Hardware-independent restores&lt;/li&gt;
  &lt;li&gt;Security preserved end-to-end&lt;/li&gt;
  &lt;li&gt;Easy to test periodically&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;lessons-learned&quot;&gt;Lessons Learned&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Infrastructure should be boring, not clever&lt;/li&gt;
  &lt;li&gt;Backups are useless without restore tests&lt;/li&gt;
  &lt;li&gt;Bind mounts beat full-disk images&lt;/li&gt;
  &lt;li&gt;Planning recovery ahead of time reduces stress dramatically&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;div class=&quot;image-gallery&quot;&gt;
  &lt;figure&gt;
    &lt;img src=&quot;/img/nas_part2.png&quot; alt=&quot;NAS backup diagram&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
    &lt;figcaption&gt;Backup architecture overview&lt;/figcaption&gt;
  &lt;/figure&gt;
  &lt;figure&gt;
    &lt;img src=&quot;/img/Find-Failed-SSH-Logins.png&quot; alt=&quot;Failed SSH logins monitoring&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
    &lt;figcaption&gt;Finding failed logins&lt;/figcaption&gt;
  &lt;/figure&gt;
&lt;/div&gt;

&lt;h2 id=&quot;final-thoughts&quot;&gt;Final Thoughts&lt;/h2&gt;

&lt;p&gt;Self-hosting a password manager isn’t about distrust — it’s about ownership. Ownership of data, uptime, and recovery. This setup ensures that even if hardware fails, my digital identity doesn’t disappear with it.&lt;/p&gt;

&lt;p&gt;If I never need the fallback Pi, that’s success.&lt;br /&gt;
If I do, I’ll be glad I treated resilience as a first-class feature.&lt;/p&gt;
</description>
        <pubDate>Sun, 18 Jan 2026 14:00:00 +0000</pubDate>
        <link>https://jamielab.me/blog/2026/01/18/vaultwarden-backup-solution/</link>
        <guid isPermaLink="true">https://jamielab.me/blog/2026/01/18/vaultwarden-backup-solution/</guid>
        
        <category>homelab</category>
        
        <category>security</category>
        
        <category>self-hosting</category>
        
      </item>
    
      <item>
        <title>Backing Up a Raspberry Pi Home Directory (Without Hoarding 15 GB Forever)</title>
        <description>&lt;p&gt;Backups are one of those things everyone agrees are important—right up until disk space mysteriously vanishes and no one remembers what’s actually being backed up.&lt;/p&gt;

&lt;p&gt;Today I cleaned up my Raspberry Pi desktop backup strategy and replaced a bulky ~15 GB backup with a &lt;strong&gt;compressed, verified, and reproducible archive weighing in at just 4.6 GB&lt;/strong&gt;. Same data. Less entropy.&lt;/p&gt;

&lt;h2 id=&quot;the-problem&quot;&gt;The Problem&lt;/h2&gt;

&lt;p&gt;I had previously backed up my Raspberry Pi home directory by copying it directly to an external drive. It worked, but it had a few flaws:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;No compression&lt;/li&gt;
  &lt;li&gt;No clear snapshot date&lt;/li&gt;
  &lt;li&gt;Included caches and trash&lt;/li&gt;
  &lt;li&gt;Owned by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;root&lt;/code&gt;, which quietly blocked future writes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short: functional, but sloppy.&lt;/p&gt;

&lt;h2 id=&quot;the-fix&quot;&gt;The Fix&lt;/h2&gt;

&lt;p&gt;The goal was simple:&lt;br /&gt;
Create a &lt;strong&gt;compressed, timestamped backup of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/home&lt;/code&gt;&lt;/strong&gt;, store it on a mounted external drive, and verify it before touching the old backup.&lt;/p&gt;

&lt;p&gt;The solution used good old &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tar&lt;/code&gt; with gzip compression, while excluding directories that don’t belong in backups (cache and trash):&lt;/p&gt;

&lt;p&gt;```bash
tar –exclude=/home/jimjamscozz22/.cache &lt;br /&gt;
    –exclude=/home/jimjamscozz22/.local/share/Trash &lt;br /&gt;
    -czvf /media/jimjamscozz22/Pi_Backup/pi_backups/home-2026-01-16.tar.gz &lt;br /&gt;
    /home/jimjamscozz22&lt;/p&gt;
</description>
        <pubDate>Sat, 17 Jan 2026 00:00:00 +0000</pubDate>
        <link>https://jamielab.me/blog/2026/01/17/backing-up-pi/</link>
        <guid isPermaLink="true">https://jamielab.me/blog/2026/01/17/backing-up-pi/</guid>
        
        <category>raspberry-pi</category>
        
        <category>linux</category>
        
        <category>tar</category>
        
        <category>backups</category>
        
        <category>homelab</category>
        
      </item>
    
      <item>
        <title>Troubleshooting DNS Issues</title>
        <description>&lt;p&gt;DNS problems can be frustrating and hard to track down. Here are some practical steps and tools to diagnose what’s going wrong.&lt;/p&gt;

&lt;h2 id=&quot;quick-diagnostic-commands&quot;&gt;Quick Diagnostic Commands&lt;/h2&gt;

&lt;h3 id=&quot;check-your-dns-configuration&quot;&gt;Check Your DNS Configuration&lt;/h3&gt;
&lt;p&gt;First, verify which DNS servers your system is using:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Linux/Mac&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /etc/resolv.conf

&lt;span class=&quot;c&quot;&gt;# Windows&lt;/span&gt;
ipconfig /all
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;test-dns-resolution&quot;&gt;Test DNS Resolution&lt;/h3&gt;
&lt;p&gt;Use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nslookup&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dig&lt;/code&gt; to query DNS directly:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Simple lookup&lt;/span&gt;
nslookup google.com

&lt;span class=&quot;c&quot;&gt;# Detailed response with dig&lt;/span&gt;
dig google.com

&lt;span class=&quot;c&quot;&gt;# Specify a particular DNS server&lt;/span&gt;
dig @8.8.8.8 google.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;common-issues--solutions&quot;&gt;Common Issues &amp;amp; Solutions&lt;/h2&gt;

&lt;h3 id=&quot;dns-not-resolving&quot;&gt;DNS Not Resolving&lt;/h3&gt;
&lt;p&gt;If names aren’t resolving to IPs:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Check connectivity first&lt;/strong&gt; — can you ping the DNS server itself?&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Try a different DNS server&lt;/strong&gt; — test with 8.8.8.8 or 1.1.1.1&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Flush DNS cache&lt;/strong&gt; — &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo systemctl restart systemd-resolved&lt;/code&gt; (Linux) or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ipconfig /flushdns&lt;/code&gt; (Windows)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;slow-dns-queries&quot;&gt;Slow DNS Queries&lt;/h3&gt;
&lt;p&gt;If resolution is sluggish:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Check for timeouts&lt;/strong&gt; — use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dig +stats&lt;/code&gt; to see query time&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Too many hops&lt;/strong&gt; — consider switching to a faster DNS provider&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Local DNS cache issues&lt;/strong&gt; — restart your DNS service&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;nxdomain-errors&quot;&gt;NXDOMAIN Errors&lt;/h3&gt;
&lt;p&gt;This means the domain doesn’t exist in DNS:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Verify the domain name&lt;/strong&gt; — typos are common&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Check DNS propagation&lt;/strong&gt; — new domains take time to propagate&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Try another DNS server&lt;/strong&gt; — sometimes specific providers don’t have updated records&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;tools-that-help&quot;&gt;Tools That Help&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;dig&lt;/strong&gt; — most detailed DNS lookups&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;nslookup&lt;/strong&gt; — simpler alternative to dig&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;host&lt;/strong&gt; — quick hostname resolution&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;dnstracer&lt;/strong&gt; — trace the DNS resolution path&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;whois&lt;/strong&gt; — check domain registration info&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;prevention&quot;&gt;Prevention&lt;/h2&gt;

&lt;p&gt;Configure multiple DNS servers for redundancy, and consider using a local DNS cache like Pi-hole to reduce resolution time and add a layer of control.&lt;/p&gt;
</description>
        <pubDate>Sun, 11 Jan 2026 15:00:00 +0000</pubDate>
        <link>https://jamielab.me/blog/2026/01/11/troubleshooting-dns-issues/</link>
        <guid isPermaLink="true">https://jamielab.me/blog/2026/01/11/troubleshooting-dns-issues/</guid>
        
        <category>dns</category>
        
        <category>troubleshooting</category>
        
        <category>networking</category>
        
      </item>
    
      <item>
        <title>Setting up a new dev device</title>
        <description>&lt;p&gt;New machine day. This is the short, repeatable setup I use to get a device ready for development. The examples assume Ubuntu/Debian; adjust for your distro.&lt;/p&gt;

&lt;h2 id=&quot;1-update-the-base-system&quot;&gt;1. Update the base system&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt update
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt upgrade &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If this is a fresh install, reboot once so kernel and firmware updates are applied.&lt;/p&gt;

&lt;h2 id=&quot;2-install-essentials&quot;&gt;2. Install essentials&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  build-essential &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  git &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  curl &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  wget &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  unzip &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  jq &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  tmux &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  htop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;3-set-up-git&quot;&gt;3. Set up Git&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; user.name &lt;span class=&quot;s2&quot;&gt;&quot;Your Name&quot;&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; user.email &lt;span class=&quot;s2&quot;&gt;&quot;you@example.com&quot;&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; init.defaultBranch main
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;4-create-ssh-keys-for-git-hosting&quot;&gt;4. Create SSH keys for Git hosting&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh-keygen &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; ed25519 &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;you@example.com&quot;&lt;/span&gt;
ssh-agent &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;
ssh-add ~/.ssh/id_ed25519
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Add the public key to your Git host:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; ~/.ssh/id_ed25519.pub
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;5-editor-and-shell-quality-of-life&quot;&gt;5. Editor and shell quality-of-life&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Install your editor (VS Code, Neovim, etc.)&lt;/li&gt;
  &lt;li&gt;Set a consistent shell prompt theme&lt;/li&gt;
  &lt;li&gt;Enable useful aliases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example for Neovim:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; neovim
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;6-language-runtimes&quot;&gt;6. Language runtimes&lt;/h2&gt;

&lt;p&gt;Install the languages you use most. I usually start with Python and Node:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; python3 python3-venv python3-pip
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; nodejs npm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you prefer version managers, set up &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pyenv&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nvm&lt;/code&gt; early to avoid rework.&lt;/p&gt;

&lt;h2 id=&quot;7-containers-and-local-services&quot;&gt;7. Containers and local services&lt;/h2&gt;

&lt;p&gt;If you do local development with containers:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; docker.io docker-compose
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;usermod &lt;span class=&quot;nt&quot;&gt;-aG&lt;/span&gt; docker &lt;span class=&quot;nv&quot;&gt;$USER&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Log out and back in so the group change applies.&lt;/p&gt;

&lt;h2 id=&quot;8-restore-dotfiles&quot;&gt;8. Restore dotfiles&lt;/h2&gt;

&lt;p&gt;Pull your dotfiles repo and apply them. Keep this step late so base packages are present.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone git@github.com:yourname/dotfiles.git ~/dotfiles
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;9-quick-security-pass&quot;&gt;9. Quick security pass&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Enable the firewall&lt;/li&gt;
  &lt;li&gt;Set up automatic updates if desired&lt;/li&gt;
  &lt;li&gt;Make sure disk encryption is enabled on laptops&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw &lt;span class=&quot;nb&quot;&gt;enable
sudo &lt;/span&gt;ufw allow ssh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;10-sanity-checklist&quot;&gt;10. Sanity checklist&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git clone&lt;/code&gt; works over SSH&lt;/li&gt;
  &lt;li&gt;Editor launches and has plugins installed&lt;/li&gt;
  &lt;li&gt;Your preferred languages run&lt;/li&gt;
  &lt;li&gt;Terminal and fonts look right&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is it. After this, I usually keep a small &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setup.md&lt;/code&gt; in the repo to record anything specific to that machine.&lt;/p&gt;
</description>
        <pubDate>Sat, 10 Jan 2026 14:00:00 +0000</pubDate>
        <link>https://jamielab.me/blog/2026/01/10/setting-up-coding/</link>
        <guid isPermaLink="true">https://jamielab.me/blog/2026/01/10/setting-up-coding/</guid>
        
        <category>linux</category>
        
        <category>dev</category>
        
        <category>workflow</category>
        
      </item>
    
      <item>
        <title>Setting up Nginx on a Linux Server</title>
        <description>&lt;p&gt;When getting a new Linux server or VM ready for remote access, setting up Nginx (reverse proxy) is one of the first tasks. Here’s a quick guide to get you started securely.&lt;/p&gt;

&lt;h2 id=&quot;-quick-start-guide-reverse-proxy-setup-with-nginx&quot;&gt;🚀 Quick-Start Guide: Reverse Proxy Setup with Nginx&lt;/h2&gt;

&lt;h2 id=&quot;overview&quot;&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;This guide walks you through setting up &lt;strong&gt;Nginx as a reverse proxy&lt;/strong&gt;, which forwards incoming HTTP/HTTPS requests to a local service (e.g., FastAPI running on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost:8000&lt;/code&gt;). This is common for securing, scaling, or managing backend services.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;1-install-nginx&quot;&gt;&lt;strong&gt;1. Install Nginx&lt;/strong&gt;&lt;/h2&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt update
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;nginx &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;Verify installation:
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;systemctl status nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;2-configure-the-reverse-proxy&quot;&gt;&lt;strong&gt;2. Configure the Reverse Proxy&lt;/strong&gt;&lt;/h2&gt;
&lt;h3 id=&quot;-create-a-new-config-file&quot;&gt;📄 Create a New Config File&lt;/h3&gt;
&lt;p&gt;Create a configuration file for your domain (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yourdomain.com&lt;/code&gt;) in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/nginx/sites-available/&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;nano /etc/nginx/sites-available/yourdomain.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;️-paste-this-example-configuration&quot;&gt;✏️ Paste This Example Configuration&lt;/h3&gt;
&lt;p&gt;Replace &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yourdomain.com&lt;/code&gt; and the backend service (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost:8000&lt;/code&gt;) with your actual domain and app:&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yourdomain.com&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;proxy_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;http://localhost:8000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Forward requests to your app&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Host&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;X-Real-IP&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$remote_addr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;X-Forwarded-For&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$proxy_add_x_forwarded_for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;X-Forwarded-Proto&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$scheme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;-enable-the-config-file&quot;&gt;🔗 Enable the Config File&lt;/h3&gt;
&lt;p&gt;Link it to Nginx’s active config directory:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;3-test--reload-nginx&quot;&gt;&lt;strong&gt;3. Test &amp;amp; Reload Nginx&lt;/strong&gt;&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Check for syntax errors:
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;nginx &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Apply changes:
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl reload nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;4-verify-it-works&quot;&gt;&lt;strong&gt;4. Verify It Works&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Make sure your backend service is running (e.g., FastAPI on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost:8000&lt;/code&gt;).&lt;/p&gt;

&lt;h3 id=&quot;-test-with-curl-or-a-browser&quot;&gt;✅ Test with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl&lt;/code&gt; or a Browser&lt;/h3&gt;
&lt;p&gt;Visit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://yourdomain.com&lt;/code&gt; in your browser or run:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl http://yourdomain.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You should see the output from your backend app!&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;5-optional-secure-with-https-using-lets-encrypt&quot;&gt;&lt;strong&gt;5. (Optional) Secure with HTTPS Using Let’s Encrypt&lt;/strong&gt;&lt;/h2&gt;

&lt;h3 id=&quot;-install-certbot--obtain-certificate&quot;&gt;🔐 Install Certbot &amp;amp; Obtain Certificate&lt;/h3&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;certbot python3-certbot-nginx &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;certbot &lt;span class=&quot;nt&quot;&gt;--nginx&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; yourdomain.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;Follow the prompts (agree to terms, select email).&lt;/li&gt;
  &lt;li&gt;Nginx will be automatically configured for HTTPS.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;-verify-https-works&quot;&gt;✅ Verify HTTPS Works&lt;/h3&gt;
&lt;p&gt;Visit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://yourdomain.com&lt;/code&gt; and ensure you see a secure connection (lock icon).&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;6-common-checks--fixes&quot;&gt;&lt;strong&gt;6. Common Checks &amp;amp; Fixes&lt;/strong&gt;&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;🔧 If Nginx fails:
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl status nginx
&lt;span class=&quot;nb&quot;&gt;sudo tail&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; 20 /var/log/nginx/error.log
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;🔄 Ensure your backend app is listening on the correct port (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;localhost:8000&lt;/code&gt;).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;🔓 Open firewall ports if needed:
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw allow &lt;span class=&quot;s1&quot;&gt;&apos;Nginx&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;7-done&quot;&gt;&lt;strong&gt;7. Done!&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;You now have a working reverse proxy with Nginx, ready to serve your app securely over HTTP or HTTPS.&lt;/p&gt;

&lt;p&gt;💡 Next steps: Set up automatic SSL renewal (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo certbot renew --dry-run&lt;/code&gt;) or explore advanced config options like rate limiting or caching.&lt;/p&gt;
</description>
        <pubDate>Wed, 07 Jan 2026 06:45:00 +0000</pubDate>
        <link>https://jamielab.me/blog/2026/01/07/setting-up-nginx/</link>
        <guid isPermaLink="true">https://jamielab.me/blog/2026/01/07/setting-up-nginx/</guid>
        
        <category>homelab</category>
        
        <category>security</category>
        
        <category>linux</category>
        
      </item>
    
      <item>
        <title>Setting up SSH on a Linux Server</title>
        <description>&lt;p&gt;When getting a new Linux server or VM ready for remote access, setting up SSH (Secure Shell) is one of the first tasks. Here’s a quick guide to get you started securely.&lt;/p&gt;

&lt;h2 id=&quot;the-first-steps&quot;&gt;The first steps&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Install OpenSSH Server&lt;/strong&gt; (if not already installed):&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 1. Install OpenSSH Server&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt update
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;openssh-server
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2-configure-ssh&quot;&gt;2. Configure SSH&lt;/h3&gt;
&lt;p&gt;Edit the SSH configuration file to enhance security:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 2. Edit SSH configuration&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;nano /etc/ssh/sshd_config
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Make the following changes:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Change the default port (optional but recommended):
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Port 2222
&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Disable root login:
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PermitRootLogin no
&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Allow only specific users (optional):
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AllowUsers your_username
&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Save and exit the file.&lt;/li&gt;
  &lt;li&gt;Restart the SSH service to apply changes:
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl restart sshd
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;h2 id=&quot;enable-ufw-firewall&quot;&gt;Enable UFW Firewall&lt;/h2&gt;
    &lt;p&gt;To secure your SSH server, it’s a good idea to set up a firewall using UFW (Uncomplicated Firewall).&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 1. Default deny incoming, allow outgoing&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw default deny incoming
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw default allow outgoing 
&lt;span class=&quot;c&quot;&gt;# 2. Allow SSH on the new port&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw allow 2222/tcp
&lt;span class=&quot;c&quot;&gt;# 3. Enable it&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw &lt;span class=&quot;nb&quot;&gt;enable&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;check-status&quot;&gt;Check status&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw status numbered
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Quick, easy, and essential for a secure lab environment.&lt;/p&gt;

&lt;div class=&quot;image-gallery&quot;&gt;
  &lt;figure&gt;
    &lt;img src=&quot;/img/sshdiagram.png&quot; alt=&quot;SSH diagram&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
    &lt;figcaption&gt;SSH overview&lt;/figcaption&gt;
  &lt;/figure&gt;
  &lt;figure&gt;
    &lt;img src=&quot;/img/Find-Failed-SSH-Logins.png&quot; alt=&quot;Failed SSH logins&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
    &lt;figcaption&gt;Finding failed logins&lt;/figcaption&gt;
  &lt;/figure&gt;
&lt;/div&gt;
</description>
        <pubDate>Wed, 24 Dec 2025 06:45:00 +0000</pubDate>
        <link>https://jamielab.me/blog/2025/12/24/setting-up-ssh/</link>
        <guid isPermaLink="true">https://jamielab.me/blog/2025/12/24/setting-up-ssh/</guid>
        
        <category>homelab</category>
        
        <category>security</category>
        
        <category>linux</category>
        
      </item>
    
      <item>
        <title>Setting up basic UFW rules</title>
        <description>&lt;p&gt;When spinning up a new VM in the lab, one of the first things I do is set up a basic firewall. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ufw&lt;/code&gt; (Uncomplicated Firewall) is perfect for this.&lt;/p&gt;

&lt;p&gt;Locking down ingress early reduces the blast radius if a service is misconfigured or exposed during setup. It also forces you to be intentional about what gets opened.&lt;/p&gt;

&lt;h2 id=&quot;the-safe-sequence&quot;&gt;The “Safe” Sequence&lt;/h2&gt;

&lt;p&gt;Always allow SSH before enabling the firewall to avoid locking yourself out!&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 1. Default deny incoming, allow outgoing&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw default deny incoming
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw default allow outgoing

&lt;span class=&quot;c&quot;&gt;# 2. Allow SSH (and other needed services)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw allow ssh
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw allow 80/tcp
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw allow 443/tcp

&lt;span class=&quot;c&quot;&gt;# 3. Enable it&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw &lt;span class=&quot;nb&quot;&gt;enable&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;common-mistakes&quot;&gt;Common mistakes&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Enabling UFW before allowing SSH (or your actual SSH port)&lt;/li&gt;
  &lt;li&gt;Forgetting to open a non-default SSH port&lt;/li&gt;
  &lt;li&gt;Allowing a web port but missing the protocol (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;80&lt;/code&gt; vs &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;80/tcp&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;allowing-a-single-ip&quot;&gt;Allowing a single IP&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw allow from x.x.x.x to any port 22
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;rate-limiting-ssh&quot;&gt;Rate limiting SSH&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw limit ssh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;check-status&quot;&gt;Check status&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw status numbered
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;disable-or-rollback&quot;&gt;Disable or rollback&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw disable
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;ufw reset
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Quick, easy, and essential for a secure lab environment.&lt;/p&gt;

&lt;h2 id=&quot;next-steps&quot;&gt;Next steps&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/projects/vaultwarden-byopm/&quot;&gt;Fail2ban and rate limiting notes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/notes/vaultwarden-compose-template/&quot;&gt;Reverse proxy hardening notes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;image-gallery&quot;&gt;
  &lt;figure&gt;
    &lt;img src=&quot;/img/ufw.webp&quot; alt=&quot;Diagram of UFW firewall rules allowing and denying traffic to a server&quot; width=&quot;1536&quot; height=&quot;1024&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
    &lt;figcaption&gt;UFW overview&lt;/figcaption&gt;
  &lt;/figure&gt;
  &lt;figure&gt;
    &lt;img src=&quot;/img/tunneledHTTPSZoom.svg&quot; alt=&quot;HTTPS tunnel diagram&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
    &lt;figcaption&gt;Hardening your Services&lt;/figcaption&gt;
  &lt;/figure&gt;
&lt;/div&gt;
</description>
        <pubDate>Wed, 24 Dec 2025 06:30:00 +0000</pubDate>
        <link>https://jamielab.me/blog/2025/12/24/setting-up-ufw-rules/</link>
        <guid isPermaLink="true">https://jamielab.me/blog/2025/12/24/setting-up-ufw-rules/</guid>
        
        <category>homelab</category>
        
        <category>security</category>
        
        <category>linux</category>
        
      </item>
    
      <item>
        <title>Welcome to the blog</title>
        <description>&lt;p&gt;I’m going to use this blog for short informational posts: quick runbooks, lab lessons learned, and small security notes I want to remember.&lt;/p&gt;

&lt;h2 id=&quot;what-to-expect&quot;&gt;What to expect&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Short posts with practical takeaways&lt;/li&gt;
  &lt;li&gt;Commands, configs, and checklists&lt;/li&gt;
  &lt;li&gt;Updates to homelab builds and projects&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;quick-example-make-sure-everything-is-up-to-date&quot;&gt;Quick example: make sure everything is up-to-date&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt update &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt upgrade &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;another-example-checking-disk-usage&quot;&gt;Another example: checking disk usage&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;df&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This will show you how much disk space is used and available on your filesystems.&lt;/p&gt;

&lt;h2 id=&quot;one-more-checking-memory-usage&quot;&gt;One more: checking memory usage&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;free &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This command gives you a quick overview of your system’s memory usage.&lt;/p&gt;
&lt;h2 id=&quot;stay-tuned-for-more-posts-like-these-ill-be-adding-content-regularly-to-help-document-my-homelab-journey-and-share-useful-tips-with-others&quot;&gt;Stay tuned for more posts like these. I’ll be adding content regularly to help document my homelab journey and share useful tips with others.&lt;/h2&gt;

</description>
        <pubDate>Sat, 13 Dec 2025 07:25:00 +0000</pubDate>
        <link>https://jamielab.me/blog/2025/12/13/welcome-to-the-blog/</link>
        <guid isPermaLink="true">https://jamielab.me/blog/2025/12/13/welcome-to-the-blog/</guid>
        
        <category>blog</category>
        
        <category>homelab</category>
        
        <category>security</category>
        
      </item>
    
  </channel>
</rss>
