<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vasilis Aivalis</title>
    <description>The latest articles on DEV Community by Vasilis Aivalis (@aivalisv).</description>
    <link>https://dev.to/aivalisv</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2837608%2F739d6639-23fb-4809-bae4-4ca799e9b87c.jpg</url>
      <title>DEV Community: Vasilis Aivalis</title>
      <link>https://dev.to/aivalisv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aivalisv"/>
    <language>en</language>
    <item>
      <title>Publish a Proxmox LXC App with Cloudflare Tunnel - even Behind CGNAT</title>
      <dc:creator>Vasilis Aivalis</dc:creator>
      <pubDate>Tue, 24 Nov 2026 11:08:31 +0000</pubDate>
      <link>https://dev.to/aivalisv/publish-a-proxmox-lxc-app-with-cloudflare-tunnel-even-behind-cgnat-45fe</link>
      <guid>https://dev.to/aivalisv/publish-a-proxmox-lxc-app-with-cloudflare-tunnel-even-behind-cgnat-45fe</guid>
      <description>&lt;p&gt;Hosting a website at home is straightforward until you need to make it accessible from the internet. Dynamic IP addresses, router configuration, and Carrier-Grade NAT can quickly complicate things.&lt;/p&gt;

&lt;p&gt;For this example, I used a Debian LXC container on Proxmox, Nginx, and Cloudflare Tunnel. The container lives on a dedicated VLAN managed by a UniFi gateway, and visitors reach the website through a public hostname.&lt;/p&gt;

&lt;p&gt;In this walkthrough, we’ll build that setup from the network configuration through to a working HTTPS website.&lt;/p&gt;

&lt;p&gt;We’ll cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How Cloudflare Tunnel works behind CGNAT.&lt;/li&gt;
&lt;li&gt;Creating a dedicated VLAN in UniFi.&lt;/li&gt;
&lt;li&gt;Configuring Proxmox and creating an LXC container.&lt;/li&gt;
&lt;li&gt;Installing Nginx and publishing website files.&lt;/li&gt;
&lt;li&gt;Connecting cloudflared to Cloudflare.&lt;/li&gt;
&lt;li&gt;Mapping a public hostname to an application.&lt;/li&gt;
&lt;li&gt;Troubleshooting common networking and deployment problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Understand the architecture
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Cloudflare Tunnel&lt;/strong&gt; connects your server to Cloudflare. &lt;strong&gt;cloudflared&lt;/strong&gt; is the connector application that runs on your server and establishes the outbound connection.&lt;/p&gt;

&lt;p&gt;Visitors connect to Cloudflare, which forwards their requests through the tunnel to your application. You do not need a publicly reachable home IP address or inbound port forwarding.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fscsi6m689ytcbys07l5s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fscsi6m689ytcbys07l5s.png" alt="Our Setup" width="800" height="850"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why this works with CGNAT&lt;/strong&gt;&lt;br&gt;
With Carrier-Grade NAT, your ISP places another NAT layer between your router and the public internet. Multiple customers may share a public IPv4 address.&lt;/p&gt;

&lt;p&gt;A port-forwarding rule on your home router cannot configure that upstream NAT layer. Consequently, forwarding ports 80 and 443 on your router may still leave your website unreachable.&lt;/p&gt;

&lt;p&gt;Cloudflared initiates an outbound connection. Requests return through that established connection, so unsolicited inbound connectivity is unnecessary.&lt;/p&gt;

&lt;p&gt;This still requires working outbound internet access: CGNAT does not prevent the approach, but an upstream firewall can block the tunnel’s required traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VLAN, NAT, and “DMZ”&lt;/strong&gt;&lt;br&gt;
These terms describe different things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VLAN&lt;/strong&gt;: separates the application’s network from your other networks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAT&lt;/strong&gt;: translates addresses as traffic passes through your router.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DMZ network&lt;/strong&gt;: a dedicated network whose access is restricted by firewall policies.
In this article, “DMZ” means a separate VLAN. It does not mean enabling a consumer router’s “DMZ host” feature, which forwards unsolicited inbound traffic to a device.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep ordinary outbound NAT enabled. No special inbound NAT or port-forwarding rule is needed.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Gather the prerequisites
&lt;/h2&gt;

&lt;p&gt;You’ll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A working Proxmox VE server with a wired network connection.&lt;/li&gt;
&lt;li&gt;A UniFi gateway and a network path that supports VLANs.&lt;/li&gt;
&lt;li&gt;A domain using Cloudflare DNS.&lt;/li&gt;
&lt;li&gt;Access to the Cloudflare dashboard.&lt;/li&gt;
&lt;li&gt;A Debian LXC template available in Proxmox.&lt;/li&gt;
&lt;li&gt;A website or application to publish.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An LXC container suits this lightweight Linux workload. Containers share the Proxmox host’s kernel; a VM is an alternative when you want a separate guest kernel. We’ll use an unprivileged container and install the software directly, without Docker or nesting.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Create the DMZ network in UniFi
&lt;/h2&gt;

&lt;p&gt;Navigate to &lt;strong&gt;UniFi Network → Settings → Networks&lt;/strong&gt; and create a virtual network with the following settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; &lt;code&gt;DMZ&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Router:&lt;/strong&gt; Your UniFi gateway&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VLAN ID:&lt;/strong&gt; &lt;code&gt;30&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gateway/Subnet:&lt;/strong&gt; &lt;code&gt;192.168.30.1/24&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DHCP:&lt;/strong&gt; Enabled (&lt;code&gt;192.168.30.100–192.168.30.200&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ensure the subnet does not overlap with another network or VPN.&lt;/p&gt;

&lt;p&gt;If the gateway provides DNS forwarding for this network, advertise 192.168.30.1 as the DNS server. Otherwise, specify a reachable DNS resolver.&lt;/p&gt;
&lt;h2&gt;
  
  
  4. Enable VLAN awareness in Proxmox
&lt;/h2&gt;

&lt;p&gt;Navigate to &lt;strong&gt;Proxmox → Host → System → Network → vmbr0 → Edit&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable &lt;strong&gt;VLAN aware&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Ensure VLAN &lt;code&gt;30&lt;/code&gt; is within the permitted VLAN range.&lt;/li&gt;
&lt;li&gt;Preserve the existing management IP, gateway and physical bridge port.&lt;/li&gt;
&lt;li&gt;Apply the configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Bridge changes may interrupt management connectivity. Ensure local console access before applying.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The VLAN-aware bridge allows individual guest interfaces to use specific VLAN tags.&lt;/p&gt;
&lt;h2&gt;
  
  
  5. Create the Debian LXC container
&lt;/h2&gt;

&lt;p&gt;If needed, select template storage in Proxmox, open CT Templates → Templates, and download a supported Debian template. Create CT and make sure that you will include this setttings : Bridge vmbr0 and VLAN tag 30 . For this example we will use CT ID 103.&lt;/p&gt;
&lt;h3&gt;
  
  
  DNS and startup
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DNS:&lt;/strong&gt; &lt;code&gt;192.168.30.1&lt;/code&gt; (if the gateway provides DNS).&lt;/li&gt;
&lt;li&gt;Start the container and enable &lt;strong&gt;Start at boot&lt;/strong&gt; under its options.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Verify network connectivity
&lt;/h3&gt;

&lt;p&gt;Run on the &lt;strong&gt;Proxmox host&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pct &lt;span class="nb"&gt;exec&lt;/span&gt; 103 -- ip -br addr
pct &lt;span class="nb"&gt;exec&lt;/span&gt; 103 -- ip route
pct &lt;span class="nb"&gt;exec&lt;/span&gt; 103 -- cat /etc/resolv.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eth0    UP    192.168.30.187/24
default via 192.168.30.1 dev eth0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enter the container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pct enter 103
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the remaining commands &lt;strong&gt;inside the container as root&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping -c 3 192.168.30.1
getent hosts pkg.cloudflare.com
apt update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;A failed ping may indicate blocked ICMP. However, &lt;code&gt;Network is unreachable&lt;/code&gt; combined with a missing default route indicates a local networking issue.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once DHCP works, reserve the container's IP address in UniFi.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Install Nginx and create a test website
&lt;/h2&gt;

&lt;p&gt;Install and start Nginx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt update
apt install -y nginx curl ca-certificates
systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; --now nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the website directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;install -d -m 0755 /var/www/myapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a simple test page:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cat &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /var/www/myapp/index.html &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s1"&gt;'EOF'&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;!doctype html&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;html &lt;span class="nv"&gt;lang&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"en"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;head&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;meta &lt;span class="nv"&gt;charset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"utf-8"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;meta &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"viewport"&lt;/span&gt; &lt;span class="nv"&gt;content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"width=device-width, initial-scale=1"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;title&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;My Proxmox Website&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/title&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/head&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;body&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;h1&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;Hello from Proxmox!&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/h1&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;p&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;This website is served by Nginx inside an LXC container.&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/p&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/body&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/html&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
EOF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Configure the Nginx site
&lt;/h3&gt;

&lt;p&gt;Since &lt;code&gt;cloudflared&lt;/code&gt; runs inside the same container, configure Nginx to listen exclusively on loopback:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cat &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /etc/nginx/sites-available/myapp &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s1"&gt;'EOF'&lt;/span&gt;
server &lt;span class="o"&gt;{&lt;/span&gt;
    listen 127.0.0.1:80 default_server&lt;span class="o"&gt;;&lt;/span&gt;
    server_name myapp.example.com&lt;span class="o"&gt;;&lt;/span&gt;

    root /var/www/myapp&lt;span class="o"&gt;;&lt;/span&gt;
    index index.html&lt;span class="o"&gt;;&lt;/span&gt;

    location / &lt;span class="o"&gt;{&lt;/span&gt;
        try_files &lt;span class="nv"&gt;$uri&lt;/span&gt; &lt;span class="nv"&gt;$uri&lt;/span&gt;/ &lt;span class="o"&gt;=&lt;/span&gt;404&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    location ~ /\. &lt;span class="o"&gt;{&lt;/span&gt;
        deny all&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
EOF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Disable the default site, enable the new configuration and reload Nginx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;unlink /etc/nginx/sites-enabled/default
ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/myapp
nginx -t &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; systemctl reload nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify the website:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -I http://127.0.0.1
curl http://127.0.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected response: &lt;code&gt;HTTP/1.1 200 OK&lt;/code&gt; and the test page HTML.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Loopback binding intentionally prevents direct access through the container's LAN IP. Cloudflared accesses Nginx locally.&lt;/p&gt;

&lt;p&gt;For direct LAN access, use &lt;code&gt;listen 80 default_server;&lt;/code&gt; and enforce access restrictions through the firewall.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Deploy your actual website
&lt;/h3&gt;

&lt;p&gt;Replace the test page with your website files. For example, if your static website is located at &lt;code&gt;/opt/myapp&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;install -m 0644 /opt/myapp/index.html /var/www/myapp/index.html
install -m 0644 /opt/myapp/styles.css /var/www/myapp/styles.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy any additional assets, preserving their directory structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deployment considerations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Include images, fonts, PDFs, JavaScript, &lt;code&gt;robots.txt&lt;/code&gt; and sitemap files.&lt;/li&gt;
&lt;li&gt;Keep &lt;code&gt;.git&lt;/code&gt;, credentials and environment files outside the web root.&lt;/li&gt;
&lt;li&gt;For projects requiring a build step, deploy the generated output rather than the source repository.&lt;/li&gt;
&lt;li&gt;Updating static files does not require an Nginx restart.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  7. Create the Cloudflare Tunnel
&lt;/h2&gt;

&lt;p&gt;Ensure your domain is active in Cloudflare. If migrating DNS, preserve existing records, including email records.&lt;/p&gt;

&lt;p&gt;Navigate to &lt;strong&gt;Cloudflare Dashboard → Networking → Tunnels → Create Tunnel&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; &lt;code&gt;home-myapp&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Environment:&lt;/strong&gt; Linux&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Architecture:&lt;/strong&gt; Match your LXC container's architecture.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep the connector installation instructions available for the next step.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Depending on the dashboard version, tunnels may be located under &lt;strong&gt;Cloudflare One → Networks → Connectors&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://developers.cloudflare.com/tunnel/get-started/" rel="noopener noreferrer"&gt;Cloudflare Tunnel Setup Documentation&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Install cloudflared inside the LXC
&lt;/h2&gt;

&lt;p&gt;Add Cloudflare's official package repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mkdir -p --mode=0755 /usr/share/keyrings

curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg \
  &lt;span class="o"&gt;|&lt;/span&gt; tee /usr/share/keyrings/cloudflare-main.gpg &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared any main'&lt;/span&gt; \
  &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /etc/apt/sources.list.d/cloudflared.list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install and verify &lt;code&gt;cloudflared&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt update
apt install -y cloudflared
cloudflared --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://pkg.cloudflare.com/index.html" rel="noopener noreferrer"&gt;Official cloudflared Package Instructions&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Install the tunnel service
&lt;/h3&gt;

&lt;p&gt;Copy the tunnel token from your Cloudflare dashboard:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cloudflared service install YOUR_TUNNEL_TOKEN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, avoid exposing the token in Bash history:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;read&lt;/span&gt; -rsp &lt;span class="s2"&gt;"Paste tunnel token: "&lt;/span&gt; CF_TUNNEL_TOKEN
&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'\n'&lt;/span&gt;
cloudflared service install &lt;span class="s2"&gt;"$CF_TUNNEL_TOKEN"&lt;/span&gt;
&lt;span class="kd"&gt;unset&lt;/span&gt; CF_TUNNEL_TOKEN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Security:&lt;/strong&gt; Treat the tunnel token as a credential. Never expose it in screenshots, repositories or articles. The service still retains its credential locally.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Enable and verify the service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; --now cloudflared
systemctl is-active cloudflared
journalctl -u cloudflared -n 50 --no-pager
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Cloudflare dashboard should now display a &lt;strong&gt;Healthy&lt;/strong&gt; connector.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A healthy tunnel confirms connectivity to Cloudflare, but does not yet expose your website.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  9. Link the public hostname to Nginx
&lt;/h2&gt;

&lt;p&gt;Open the &lt;code&gt;home-myapp&lt;/code&gt; tunnel and add a &lt;strong&gt;Published application&lt;/strong&gt; route:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Subdomain:&lt;/strong&gt; &lt;code&gt;myapp&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Domain:&lt;/strong&gt; &lt;code&gt;example.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Path:&lt;/strong&gt; Leave blank.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service type:&lt;/strong&gt; HTTP&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service address:&lt;/strong&gt; &lt;code&gt;127.0.0.1:80&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the interface uses a single Service URL field, enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the route to map &lt;code&gt;myapp.example.com&lt;/code&gt; to the local Nginx instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developers.cloudflare.com/tunnel/get-started/" rel="noopener noreferrer"&gt;Cloudflare Application Routing Documentation&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Verify the DNS record
&lt;/h3&gt;

&lt;p&gt;Cloudflare should automatically create a proxied DNS record:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Type:    CNAME
Name:    myapp
Target:  &amp;lt;TUNNEL-UUID&amp;gt;.cfargotunnel.com
Proxy:   Enabled
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Resolve any conflicting DNS records for &lt;code&gt;myapp&lt;/code&gt;. Do not point the hostname to your home WAN IP address.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Test the public website
&lt;/h3&gt;

&lt;p&gt;Open &lt;code&gt;https://myapp.example.com&lt;/code&gt; in your browser or run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -I https://myapp.example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also test from an external network, such as a mobile phone with Wi-Fi disabled.&lt;/p&gt;

&lt;p&gt;The resulting traffic flow is:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4pwofp4fujwd09y58r6x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4pwofp4fujwd09y58r6x.png" alt="Traffic Flow" width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your website is now publicly accessible over HTTPS without exposing Nginx directly or requiring inbound port forwarding on your home router.&lt;/p&gt;

</description>
      <category>proxmox</category>
      <category>cloudflare</category>
      <category>networking</category>
      <category>selfhosted</category>
    </item>
    <item>
      <title>Run a full bitcoin node on Azure</title>
      <dc:creator>Vasilis Aivalis</dc:creator>
      <pubDate>Fri, 14 Mar 2025 18:26:23 +0000</pubDate>
      <link>https://dev.to/aivalisv/run-a-full-bitcoin-node-in-azure-5gao</link>
      <guid>https://dev.to/aivalisv/run-a-full-bitcoin-node-in-azure-5gao</guid>
      <description>&lt;p&gt;In this post, we’ll walk you through the process of setting up and running a full Bitcoin node on Microsoft Azure. Whether you're a Bitcoin enthusiast, developer, or just curious about contributing to the network, deploying your own node helps strengthen the Bitcoin ecosystem while giving you full control over your transactions and data.&lt;/p&gt;

&lt;p&gt;We’ll guide you through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploying a virtual machine (VM) in Azure&lt;/li&gt;
&lt;li&gt;Installing and configuring Bitcoin Core (bitcoind)&lt;/li&gt;
&lt;li&gt;Optimizing storage and network settings&lt;/li&gt;
&lt;li&gt;Modifying firewall rules to allow RPC communication&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By the end, you’ll have a fully operational Bitcoin node running in the cloud, ready to validate transactions and support the decentralized network. Let’s get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Deploy a Virtual Machine (VM)
&lt;/h2&gt;

&lt;p&gt;Go to &lt;a href="//portal.azure.com"&gt;Azure Portal&lt;/a&gt;&lt;br&gt;
Click: Create a resource → Compute → Virtual Machine&lt;br&gt;
Choose OS: Ubuntu 24.04 LTS x64 Gen2 (Recommended)&lt;br&gt;
Choose Size: Select a VM with:&lt;br&gt;
You can choose any type of machine you like. On the budget side a Standard_DS1_v1 with 1vCPU and 3.5GB RAM will do , but its recommended at least a Standard_D2s_v3 with 2vCPU's and 8GB RAM . Machines with more RAM would be able to sync much faster. &lt;br&gt;
SSD storage, you will need At least 1TB, as the blockchain is growing&lt;br&gt;
Standard, or Premium SSD will do the job.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F77sjusxstc7hrogxcbqo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F77sjusxstc7hrogxcbqo.png" alt=" " width="623" height="1084"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Authentication Method:&lt;br&gt;
Use SSH key (Recommended)&lt;/p&gt;

&lt;p&gt;Networking:&lt;br&gt;
Allow SSH (port 22)&lt;/p&gt;

&lt;p&gt;Attach a Data Disk for Blockchain Storage:&lt;br&gt;
Click Disks → Create and Attach a New Data Disk &lt;br&gt;
Click Create and wait for deployment.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Connect to the VM via SSH
&lt;/h2&gt;

&lt;p&gt;If you have chosen to use SSH Key as the authentication method, download the &lt;code&gt;.pem&lt;/code&gt; file that contains the key pair information.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ssh -i C:\path\to\your-key.pem user@hostname&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;replace @hostname with the public IP address as given in the azure portal Virtual Machine Overview&lt;/p&gt;

&lt;p&gt;If you are using windows and receiving errors of type "Permissions for .pem are too open." either move .pem file to your \users\youruser\Documents folder where the permissions are restricted or right-click the &lt;code&gt;.pem&lt;/code&gt; file and navigate to the Security tab to Remove all inherited permissions, and add a Basic read-only permission only for your user. &lt;/p&gt;
&lt;h2&gt;
  
  
  3. Install Bitcoin Core
&lt;/h2&gt;

&lt;p&gt;Step 1: Update and Install Dependencies&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y
sudo apt install -y software-properties-common curl jq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2: Download Bitcoin Core&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -O https://bitcoincore.org/bin/bitcoin-core-26.0/bitcoin-26.0-x86_64-linux-gnu.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 3: Extract and Install&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tar -xvf bitcoin-26.0-x86_64-linux-gnu.tar.gz
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-26.0/bin/*

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Create and configure data directory
&lt;/h2&gt;

&lt;p&gt;Once the disk is attached, you need to initialize, partition, and format it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;List the available disks:
&lt;code&gt;lsblk&lt;/code&gt; and look for the new disk for example &lt;code&gt;/dev/sdc&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create a partition
&lt;code&gt;sudo fdisk /dev/sdc&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;Press n (new partition).&lt;/li&gt;
&lt;li&gt;Press p (primary partition).&lt;/li&gt;
&lt;li&gt;Accept defaults.&lt;/li&gt;
&lt;li&gt;Press w to write changes.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Format the partition:
&lt;code&gt;sudo mkfs.ext4 /dev/sdc1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create a mount directory:
&lt;code&gt;sudo mkdir /mnt/datadisk&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Mount the disk:
&lt;code&gt;sudo mount /dev/sdc1 /mnt/datadisk&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create a folder in /mnt/datadisk 
&lt;code&gt;mkdir /mnt/datadisk/bitcoin&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  5. Configure Bitcoin Node
&lt;/h2&gt;

&lt;p&gt;Modify the bitcoind configuration file : &lt;br&gt;
&lt;code&gt;nano ~/bitcoin-26.0/bitcoin.conf&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server=1
daemon=1
txindex=1
rpcuser=myusername
rpcpassword=mysupersecurepwd
rpcbind=0.0.0.0
rpcallowip=0.0.0.0/0
prune=0
datadir=/mnt/datadisk/bitcoin
rpcport=8332
listen=1
externalip=40.113.xx.xx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;save and exit. &lt;/p&gt;

&lt;p&gt;ExternalIP is the same that you have used to connect via SSH, (the public IP address of the VM).&lt;br&gt;
you may set rpcbindallowip to 0.0.0.0/0 to allow everybody to connect via RPC to this node, or whitelist your IP address only. &lt;/p&gt;
&lt;h2&gt;
  
  
  6. Start the bitcoin deamon
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;bitcoind -daemon -conf=~/bitcoin-26.0/bitcoin.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;you may verify a successful start by using the command : &lt;br&gt;
&lt;code&gt;bitcoin-cli -conf=~/bitcoin-26.0/bitcoin.conf getblockchaininfo&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;or also by checking the bitcoin daemon running in the process list : &lt;br&gt;
&lt;code&gt;ps -aux |grep -i bitcoind&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;checking the disk usage the datadisk folder size should be increasing&lt;br&gt;
&lt;code&gt;du -h /mnt/datadisk/bitcoin/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgswvsj5uw5zyr4iji4ec.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgswvsj5uw5zyr4iji4ec.png" alt=" " width="560" height="151"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  7. Open Firewall for Public P2P Connections
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw allow 8332/tcp
sudo ufw allow 8333/tcp
sudo systemctl restart ufw
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We must also allow the ports through azure firewall. so back in the azure portal, inside the Virtual Machine -&amp;gt; Network Settings we configure the following inbound port rules:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff25s3jmbglc4aavwm8t2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff25s3jmbglc4aavwm8t2.png" alt=" " width="800" height="210"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  8. Testing the rpc communication
&lt;/h2&gt;

&lt;p&gt;Create a powershell script :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$headers = @{"Content-Type" = "application/json"}
$rpcUser = "myusername"
$rpcPassword = "mysupersecurepwd"
$uri = "http://40.113.xx.xx:8332/"
$body = '{"jsonrpc":"1.0","id":"curl","method":"getblockchaininfo","params":[]}'

Invoke-WebRequest -Uri $uri -Method Post -Headers $headers -Body $body -Credential (New-Object PSCredential $rpcUser, (ConvertTo-SecureString $rpcPassword -AsPlainText -Force))

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;by running it you should be able to get a success response. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9fpga84eqdj5atig3chr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9fpga84eqdj5atig3chr.png" alt=" " width="800" height="301"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>azure</category>
      <category>bitcoin</category>
      <category>rpc</category>
      <category>cryptocurrency</category>
    </item>
  </channel>
</rss>
