wg-easy WireGuard VPN on Ubuntu 26.04 on Azure User Guide
Overview
wg-easy is the easiest way to run your own WireGuard VPN and manage it from a browser. Instead of hand-editing wg0.conf and generating keys on the command line, you add clients, hand out configuration files and QR codes, switch peers on or off and watch who is connected from a clean web admin panel. The cloudimg image delivers wg-easy 15.5.0 on Ubuntu 26.04 LTS, running as a Docker container from an image pinned by its digest, with Docker CE from Docker's official repository. The WireGuard tunnel listens on UDP 51820; the admin panel is served over HTTPS by nginx on port 443 with a certificate made for your VM, and port 80 only redirects to HTTPS. The admin password, the WireGuard server keys, the session secret and the certificate are all made on the first boot of your VM, so you land on a sign-in page with nothing to set up. cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours.
wg-easy is free software by Emile Nijssen and contributors, licensed under the GNU Affero General Public License v3.0 only (AGPL-3.0-only); its source is published on GitHub. cloudimg is not affiliated with, endorsed by, or sponsored by the wg-easy project. "WireGuard" is a registered trademark of Jason A. Donenfeld. This image repackages the upstream wg-easy release with cloudimg's provisioning, hardening and support.
What is included:
- wg-easy 15.5.0, the official image
ghcr.io/wg-easy/wg-easypinned by digest, run by Docker with a restart policy - Docker CE 29 from Docker's official apt repository for Ubuntu 26.04
- A WireGuard tunnel on UDP
51820using the kernel's WireGuard module, with the public endpoint found on first boot - nginx in front of the admin panel: HTTPS on :443 (HTTP/2, WebSockets proxied), :80 redirecting to HTTPS and answering a plain
/healthzcheck. wg-easy's own web port listens on127.0.0.1only - A per-VM admin password, WireGuard server key pair, session secret and self-signed TLS certificate, all made on first boot. The sign-in details go to the root-only file
/root/wg-easy-credentials.txt. No default or shared login ships in the image, and the setup wizard is closed - A firewall guard that stops VPN clients reaching the Azure host's metadata and platform addresses (
169.254.169.254and168.63.129.16). Docker refuses to start without it wg-easy-selftest, which proves the VPN end to end with a real throwaway WireGuard client- cloudimg's support team on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours

Prerequisites
An active Azure subscription, an SSH key pair, and a VNet plus subnet in the target region. Standard_B2s (2 vCPU / 4 GiB RAM) is a comfortable starting point for a VPN serving dozens of devices. NSG inbound rules: allow 22/tcp from your management network, 443/tcp (the HTTPS admin panel) and 80/tcp (which only redirects to HTTPS) from where you administer the VPN, and 51820/udp for the WireGuard tunnel itself, from wherever your devices connect. Without the UDP rule the admin panel works but no client can connect.
Step 1 — Deploy from the Azure Marketplace
Sign in to the Azure Portal, choose Create a resource, search the Marketplace for wg-easy by cloudimg, and select Create. On Basics pick your subscription, resource group, region and size; under Administrator account choose SSH public key and paste your key; under Inbound port rules allow SSH (22), HTTP (80) and HTTPS (443). Then Review + create and Create.
The portal's inbound port list only offers TCP ports, so open the WireGuard port yourself once the VM is created, before you add any client. Open the VM, choose Networking → Network settings → Create port rule → Inbound port rule, and set Destination port ranges 51820, Protocol UDP, Action Allow, then Add. From the Azure CLI the same rule is one command:
az vm open-port --resource-group <your-rg> --name <your-vm> --port 51820 --priority 1020
Without this rule no client can connect: the client shows the tunnel as on, no handshake ever completes, and a device using the default full-tunnel profile loses its internet connection until the tunnel is turned off.
Step 2 — Deploy from the Azure CLI
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn cloudimg1647283583153:wg-easy-ubuntu-26-04:default:latest
az vm create \
--resource-group <your-rg> \
--name wg-easy \
--image cloudimg1647283583153:wg-easy-ubuntu-26-04:default:latest \
--size Standard_B2s \
--admin-username azureuser \
--generate-ssh-keys \
--public-ip-sku Standard
# Open the HTTPS admin panel (443), the redirect (80) and the WireGuard tunnel (UDP 51820)
az vm open-port --resource-group <your-rg> --name wg-easy --port 443 --priority 1000
az vm open-port --resource-group <your-rg> --name wg-easy --port 80 --priority 1010
az vm open-port --resource-group <your-rg> --name wg-easy --port 51820 --priority 1020
az vm open-port opens the port for every protocol. To narrow the rules, edit them in the VM's Networking page: 443 and 80 as TCP from your own network, 51820 as UDP.
Step 3 — Connect to your VM
ssh azureuser@<vm-public-ip>
The address is on the VM's Overview page in the portal, or from the CLI with az vm show -d -g <your-rg> -n wg-easy --query publicIps -o tsv.
Step 4 — Confirm the services are running
Docker runs the wg-easy container, the VPN guard keeps clients off the Azure host's addresses, and nginx serves the admin panel. All three report active. Plain HTTP answers the /healthz check and redirects everything else to HTTPS. Only nginx (80, 443) and the WireGuard tunnel (UDP 51820) face the network; wg-easy's web port listens on loopback:
systemctl is-active docker wg-easy-vpn-guard nginx
sudo docker ps --format '{{.Names}} {{.Status}}'
curl -s -o /dev/null -w 'healthz -> %{http_code}\n' http://127.0.0.1/healthz
curl -s -o /dev/null -w 'http redirect -> %{http_code} %{redirect_url}\n' http://127.0.0.1/login
curl -ks -o /dev/null -w 'https sign-in -> %{http_code}\n' https://127.0.0.1/login
sudo ss -Htuln | awk '{print $1, $5}' | grep -E ':(80|443|51820|51821)$' | sort -u
Expected output:
active
active
active
wg-easy Up 2 minutes (healthy)
healthz -> 200
http redirect -> 301 https://127.0.0.1/login
https sign-in -> 200
tcp 0.0.0.0:443
tcp 0.0.0.0:80
tcp 127.0.0.1:51821
tcp [::]:443
tcp [::]:80
udp 0.0.0.0:51820
udp [::]:51820

Step 5 — Retrieve your admin password and endpoint
On the first boot of every VM, wg-easy-firstboot.service makes a random admin password, lets wg-easy create this VM's WireGuard server keys and session secret, makes the VM's TLS certificate and writes the sign-in details to a root-only file. First boot finishes about a minute after the VM starts; if you connect sooner, the first command below waits until it is done (it prints status: done):
sudo cloud-init status --wait
sudo cat /root/wg-easy-credentials.txt
The file (mode 0600, root only) holds the HTTPS address of the admin panel, the username (admin), the password, the SHA-256 fingerprint of the VM's certificate and the WireGuard endpoint clients dial:
WG_EASY_URL=https://<VM address>/
WG_EASY_USERNAME=admin
WG_EASY_PASSWORD=<WG_EASY_PASSWORD>
WG_EASY_CERT_SHA256=32:73:B8:01:...:69:12
WIREGUARD_ENDPOINT=<VM address>:51820/udp
Check the endpoint before you add a client: it must be the VM's public IP from Step 3, or a DNS name that resolves to it. If the VM sits behind a NAT gateway or a load balancer with a different address, or you want clients to dial a DNS name, set it with cloudimg-set-public-address (see Your own domain and certificate). Clients download their configuration with the current endpoint, so download (or scan) each client's configuration again after any change.

You can prove the whole sign-in and VPN path from the VM's own shell. wg-easy-cred-roundtrip reads the credentials file, signs in over HTTPS through nginx, shows that no password, a wrong password and admin/admin are all refused, that the setup wizard is closed, that the session cookie is Secure and HttpOnly and that port 80 redirects to HTTPS. It then runs wg-easy-selftest (Step 9). The password is passed to curl on its standard input, never on a command line:
sudo wg-easy-cred-roundtrip
Expected output (the first line is a short fingerprint of this VM's password, different on every VM):
admin password sha256 prefix: <12 hex characters>
https sign-in OK; no auth 401, wrong 401, admin/admin 401; setup closed (302 /login, API 400); cookie Secure+HttpOnly; :80 -> https
SELFTEST_OK throwaway client selftest-bada7b92 (VPN address 10.8.0.2): handshake OK, ping 10.8.0.1 OK, internet through the VPN OK (HTTPS 301), Azure IMDS and WireServer unreachable from the VPN
WG_EASY_ROUNDTRIP_OK
Step 6 — Sign in
Browse to https://<vm-public-ip>/. Because the image ships a per-VM self-signed certificate, your browser shows a one-time certificate warning on the first visit. To be sure you are talking to your own VM, compare the certificate's SHA-256 fingerprint in the browser's certificate viewer with WG_EASY_CERT_SHA256 from the credentials file, then continue. Or install your own domain's certificate (see Your own domain and certificate below). Sign in with the username admin and the password from Step 5.
The Clients page lists every VPN client with its VPN address, when it last connected, its live transfer rate and a switch to turn it on or off. The icons on each row edit the client, show its QR code, download its .conf file, or make a one-time share link.

Step 7 — Add a VPN client and connect a device
Click New, give the client a name such as alex-laptop, optionally set an expiry date, and click Create. wg-easy makes a key pair and a preshared key for the client and gives it the next VPN address (10.8.0.2, 10.8.0.3 and so on; the server is 10.8.0.1).
To connect a phone, click the client's QR code icon, open the official WireGuard app, choose Add a tunnel → Create from QR code, and point it at the screen. On a desktop, use the download icon to save the .conf file and import it into the WireGuard client. Each QR code and .conf file holds that client's private key, so share it only with the client's owner, and delete the client in wg-easy if one is ever exposed.

Once the device shows the tunnel as active, confirm the handshake on the VM:
sudo docker exec wg-easy wg show wg0 latest-handshakes
Each connected client shows a recent timestamp next to its public key; 0 means it has never completed a handshake. The default profile sends all of the device's traffic through the VPN (AllowedIPs = 0.0.0.0/0, ::/0), so its public IP becomes the VM's. If no handshake ever completes, the 51820/udp inbound rule from Step 1 or Step 2 is missing, or the client's Endpoint is not the VM's public address (see Step 5).
Step 8 — Server settings in the Admin Panel
Open Administrator (top right) → Admin Panel. Config holds the Host (the endpoint written into client configurations), the DNS servers and the default Allowed IPs pushed to new clients. Set Allowed IPs to your private networks, for example 10.0.0.0/8, if you want a split tunnel instead of sending all traffic through the VPN. Interface holds the MTU, the WireGuard port and the network device. If you change the port, change the 51820/udp NSG rule to match and recreate the container with the new port published (support can help). Hooks runs commands on the server when the interface comes up or goes down.

Change the admin password from Administrator → Account. If you do, update WG_EASY_PASSWORD in /root/wg-easy-credentials.txt too: the image's tools (wg-easy-cred-roundtrip, wg-easy-selftest and cloudimg-set-public-address) read it from there.
Step 9 — Prove the VPN end to end
wg-easy-selftest creates a throwaway client through wg-easy's API, brings up a real WireGuard tunnel to the server from the VM itself, and checks the handshake, a ping to the server's VPN address (10.8.0.1), internet access through the tunnel, and that the Azure host's metadata and platform addresses are unreachable from the VPN. It then deletes the client and its keys:
sudo wg-easy-selftest
Expected output:
SELFTEST_OK throwaway client selftest-b35ea302 (VPN address 10.8.0.2): handshake OK, ping 10.8.0.1 OK, internet through the VPN OK (HTTPS 301), Azure IMDS and WireServer unreachable from the VPN

Step 10 — Confirm the version and the stack
sudo docker inspect --format '{{.Config.Image}}' wg-easy
sudo docker image inspect --format '{{index .Config.Labels "org.opencontainers.image.version"}} {{index .Config.Labels "org.opencontainers.image.licenses"}}' ghcr.io/wg-easy/wg-easy:15.5.0
docker --version
nginx -v
lsmod | grep '^wireguard'
sudo docker exec wg-easy wg show wg0 listen-port
lsb_release -ds
Expected output:
ghcr.io/wg-easy/wg-easy@sha256:071f79a639e9361123a5e57733107320207b844ddbbd92dfa6962f541fe8aac8
v15.5.0 AGPL-3.0
Docker version 29.10.1, build c48360f
nginx version: nginx/1.28.3 (Ubuntu)
wireguard 118784 0
51820
Ubuntu 26.04.1 LTS

Server components
| Component | Version | Runs as | Listens on |
|---|---|---|---|
| wg-easy | 15.5.0 (image pinned by digest) | the wg-easy container, started by docker.service |
127.0.0.1:51821 (web), UDP :51820 (WireGuard) |
| Docker CE | 29 (Docker's apt repository) | docker.service |
|
| nginx | 1.28 (Ubuntu archive) | nginx.service |
:80 (health check and redirect), :443 (HTTPS) |
| VPN guard | nftables table inet cloudimg_vpn_guard |
wg-easy-vpn-guard.service |
|
| WireGuard | the Ubuntu kernel module | ||
| Ubuntu | 26.04 LTS |
Filesystem layout
| Path | What it holds |
|---|---|
/var/lib/wg-easy |
wg-easy's state (mode 0700): the WireGuard server configuration wg0.conf and the database wg-easy.db with every client, its keys and the settings. It is mounted into the container as /etc/wireguard |
/root/wg-easy-credentials.txt |
The per-VM admin sign-in, certificate fingerprint and WireGuard endpoint (root-only) |
/etc/nginx/ssl/wg-easy.crt, wg-easy.key |
The TLS certificate and key (the key is root-only) |
/etc/nginx/sites-available/cloudimg-wg-easy |
The nginx site |
/etc/cloudimg/wg-easy-vpn-guard.nft |
The VPN guard's firewall rules |
/etc/systemd/system/docker.service.d/cloudimg-vpn-guard.conf |
Makes Docker require the VPN guard |
/usr/local/sbin/wg-easy-* |
The image's tools: wg-easy-selftest, wg-easy-cred-roundtrip, wg-easy-tls-cert, wg-easy-vpn-guard-check and the first-boot script |
/mnt |
The Azure temporary disk: lost on deallocation, never for data |
First-boot service and security model
The image ships with an empty /var/lib/wg-easy: no WireGuard keys, no session secret, no admin and no certificate. On your VM's first boot, wg-easy-firstboot.service finds the VM's public address, makes the TLS certificate for it, and starts wg-easy once with its unattended setup variables. Those variables, the admin password among them, are passed through a root-only file in memory that is deleted at once, never on a command line. wg-easy creates the admin, this VM's server key pair and its session secret. First boot then recreates the container without any setup variables, so docker inspect holds no password. nginx answers 503 on HTTPS until first boot has finished, so nobody can reach the admin panel before your admin exists. The setup wizard is closed: its pages redirect to the sign-in page.
wg-easy runs with INSECURE=false, so its session cookie is only ever sent over HTTPS. Its web port is published on 127.0.0.1 only, so the admin panel is reachable only through nginx's TLS. The VPN guard drops any packet a VPN client sends towards the Azure host's metadata service (169.254.169.254) or platform address (168.63.129.16), so a VPN client can never read the VM's managed identity tokens or settings. Docker requires the guard and checks it is loaded before every start, so the VPN never runs without it.
sudo journalctl -u wg-easy-firstboot --no-pager -o cat | grep -o 'firstboot: .*'
sudo docker inspect --format '{{range .Config.Env}}{{println .}}{{end}}' wg-easy | grep -E '^(INIT_|INSECURE)'
sudo docker port wg-easy
curl -ks -o /dev/null -w 'setup wizard -> %{http_code} %{redirect_url}\n' https://127.0.0.1/setup/1
echo | openssl s_client -connect 127.0.0.1:443 2>/dev/null | openssl x509 -noout -subject -ext basicConstraints,subjectAltName
sudo nft list table inet cloudimg_vpn_guard | grep -E 'hook|drop'
Expected output: first boot's steps, no setup variable left but INIT_ENABLED=false, INSECURE=false, the web port on loopback only, the setup wizard redirecting to the sign-in page, an end-entity certificate made for this VM's address, and the guard's drop rule:
firstboot: WireGuard endpoint: <VM address>:51820 (from Azure metadata (load balancer))
firstboot: TLS certificate made for <VM address> (SHA-256 32:73:B8:01:...:69:12)
firstboot: Starting wg-easy for the unattended INIT_* setup
firstboot: API auth proved (setup): per-VM password 200, none 401, wrong 401
firstboot: Recreating the container without the INIT_* variables
firstboot: API auth proved (after recreate): per-VM password 200, none 401, wrong 401
firstboot: public address <VM address> recorded; cloudimg-set-public-address installed
firstboot: First-boot complete; wg-easy is serving on 127.0.0.1:51821 and nginx (ordered after this unit) fronts it on :443.
INSECURE=false
INIT_ENABLED=false
51820/udp -> 0.0.0.0:51820
51820/udp -> [::]:51820
51821/tcp -> 127.0.0.1:51821
setup wizard -> 302 https://127.0.0.1/login
subject=CN=<VM address>, O=cloudimg
X509v3 Subject Alternative Name:
IP Address:<VM address>, IP Address:127.0.0.1
X509v3 Basic Constraints: critical
CA:FALSE
type filter hook forward priority filter - 10; policy accept;
ip daddr { 168.63.129.16, 169.254.169.254 } counter packets 34 bytes 2040 drop comment "vpn-no-azure-host"

Managing the services
sudo docker ps --filter name=wg-easy --format '{{.Names}} {{.Image}} {{.Status}}'
sudo docker logs --tail 20 wg-easy
Restart wg-easy with sudo docker restart wg-easy, and nginx with sudo systemctl reload nginx. The container starts with Docker at boot by its restart policy. The first-boot log is journalctl -u wg-easy-firstboot.
Your own domain and certificate
Point a DNS record (for example vpn.example.com) at the VM's public address, then move wg-easy's Host (the endpoint in new client configurations), the self-signed certificate and the credentials file to the name in one step:
sudo cloudimg-set-public-address vpn.example.com
Run it with no argument to go back to the VM's public IP, and again whenever the VM's address changes. Download or scan each client's configuration again afterwards. For a browser-trusted certificate, install one from your CA at /etc/nginx/ssl/wg-easy.crt (with its key at /etc/nginx/ssl/wg-easy.key, mode 0600) and run sudo systemctl reload nginx. With Let's Encrypt, once DNS points at the VM and port 80 is open to the internet, certbot's standalone mode briefly stops nginx to answer the challenge on port 80, copies the certificate into place, and saves the same steps for its automatic renewals:
sudo apt-get update && sudo apt-get install -y certbot
sudo certbot certonly --standalone -d vpn.example.com \
--pre-hook 'systemctl stop nginx' --post-hook 'systemctl start nginx' \
--deploy-hook 'install -m 0644 "$RENEWED_LINEAGE/fullchain.pem" /etc/nginx/ssl/wg-easy.crt && install -m 0600 "$RENEWED_LINEAGE/privkey.pem" /etc/nginx/ssl/wg-easy.key'
A certificate you install yourself is never replaced by the image's tools. To make a fresh self-signed one for another name instead, run sudo wg-easy-tls-cert --force <name> and sudo systemctl reload nginx.
Backup and maintenance
Everything that matters is in /var/lib/wg-easy: the server keys, every client and the settings. Back it up with the container stopped so the database is consistent, and keep the copy as safe as the keys themselves:
sudo docker stop wg-easy
sudo tar -C /var/lib -czf /root/wg-easy-backup-$(date +%F).tar.gz wg-easy
sudo docker start wg-easy
Keep the OS current with sudo apt-get update && sudo apt-get upgrade; the image ships with unattended security updates enabled. A new wg-easy release is a new image: back up first and read the project's release notes before moving to it. cloudimg's support can walk you through the upgrade.
Troubleshooting
- The browser shows a certificate warning. Expected with the self-signed certificate: compare its fingerprint with
WG_EASY_CERT_SHA256and continue, or install your own certificate (above). - HTTPS shows "wg-easy is finishing its first boot". First boot has not finished. Give it a minute after the VM starts, then check
journalctl -u wg-easy-firstboot. - A client shows the tunnel as on but nothing loads. No handshake: the
51820/udpinbound rule is missing, or the client'sEndpointis not the VM's public address.sudo docker exec wg-easy wg show wg0 latest-handshakesshows0for a client that never connected. - Client configurations carry an old address. The VM's address changed: run
sudo cloudimg-set-public-address(above), then download the configurations again. - wg-easy does not start.
systemctl status dockerandsudo docker logs wg-easyname the reason. Docker refuses to start if the VPN guard is not loaded:sudo wg-easy-vpn-guard-checksays why, andsudo systemctl restart wg-easy-vpn-guard dockerbrings both back.
Security recommendations
- Restrict
22/tcp,443/tcpand80/tcpin the NSG to the networks you administer from. Only51820/udpneeds to be open to your devices. - Keep the admin password somewhere safe; then delete
/root/wg-easy-credentials.txtif you no longer need the image's tools. - Install a browser-trusted certificate on your own domain.
- Give every device its own client, set expiry dates for temporary access, and delete a client as soon as a device is lost: its key stops working at once.
- Treat each client's
.conffile and QR code like a password: they hold its private key.
Support
cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours, for deployment, WireGuard client setup, split tunnelling and routing, your own domain and certificates, upgrades and backups. Email support@cloudimg.co.uk.