Make your BTCPay Server on Ubuntu Server public facing using Cloudflare – Upgrade your Bitcoin Node

If you prefer video in order to install Cloudflare and make your BTCPay Server public-facing, see this video for instructions. Use the below text as a way to help when you run in to something you don’t understand.

Make BTCPay Server public facing

  • Go to dash.cloudflare.com and make a free account. No need to dox any personal info.
  • Click “add a site”
  • Enter a domain name.
  • Much of the instructions will vary here depending on who your registrar is. You will want to familiarize yourself with changing settings for domain name servers and different record types. Cloudflare will try to walk you through domain nameserver settings depending on who your registrar is.
  • After you setup your domain name with cloudflare and have confirmed the connection, we can now install the downloads we need to make that work with your node.
  • Go here: https://pkg.cloudflare.com/#ubuntu-title
  • You can follow the install instructions there as they update often
  • Install cloudflared using [sudo apt install cloudflared]
  • Next use this guide to create the tunnel: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide/
  • Start with this command [cloudflared tunnel login]
  • Terminal will show you a webpage to visit in order to authenticate. Go to that webpage and click on your domain name.
  • Next create a tunnel and name it with [cloudflared tunnel create <pick a name>]
  • Remember the name you choose. Make it simple, something like btcpayserver.
  • Verify that by listing out with this command [cloudflared tunnel list]
  • Check .cloudlfared directory with [ls .cloudflared] you should see a .json file that has a string of characters as its name.
  • Make a config file in your .cloudflared directory with command [nano config.yml]
  • Paste this into the config.yml file:
url: http://localhost:23001
tunnel: <Tunnel-UUID>
credentials-file: /home/<yourusername>/.cloudflared/<Tunnel-UUID>.json
  • Change the part that says <yourusername> to match your node username
  • Open a second terminal window and login to your node
  • cd into the .cloudeflared directory with [cd .cloudflared]
  • Use [ls] to see that .json file again and copy the string of characters in front of the .json
  • In that config file you are editing in the other window, paste in that string of characters to replace the two parts that say <Tunnel-UUID>
  • Connect to an application with this command [cloudflared tunnel route dns <UUID or NAME> <hostname>] edit the command to change the UUID or NAME part to the name you chose for the tunnel earlier. The <hostname> is your domain name.
  • Run it with [cloudflared tunnel run <UUID NAME>] changing name to the one you chose for the tunnel earlier
  • You should see activity in terminal and should also now be able to go to your domain name in a browser and see your btcpay server instance
  • In the terminal window that has cloudflared running, stop it using ‘control c’
  • Now we will setup the service file so that cloudflared fires up when the node starts
  • Run [cloudflared service install]
  • We need to copy a file to the cloudflared directory. In the .cloudflared directory type the command [sudo cp /home/<yourusername>/.cloudflared/config.yml /etc/cloudflared]
  • Run it again with [sudo cloudflared service install]
  • Check status with [sudo systemctl status cloudflared] (should show active)