wg-easy Setup 2025: Your VPN in 5 Simple Steps
Ready for a secure, private VPN in 2025? Our guide shows you how to set up wg-easy with Docker in just 5 simple steps. Perfect for beginners!
Alex Volkov
DevOps engineer and self-hosting enthusiast specializing in containerized network solutions.
Introduction: Why Your Own VPN Matters in 2025
In an age of constant connectivity, your digital privacy has never been more critical. From public Wi-Fi at your local coffee shop to increasingly intrusive ISP tracking, your data is often exposed. While commercial VPN services are an option, they require you to trust a third-party company with your traffic. What if you could get all the benefits of a VPN—security, privacy, and remote access to your home network—without the trust issues or recurring fees? Welcome to the world of self-hosted VPNs.
This is where WireGuard® shines. It's a modern, incredibly fast, and lean VPN protocol that has taken the networking world by storm. However, setting it up manually can involve tedious command-line work and configuration file management. Enter wg-easy, a brilliant tool that wraps WireGuard in a simple, user-friendly web interface. It makes managing your own VPN server an absolute breeze.
In this guide, we'll walk you through a complete wg-easy setup for 2025. Using the power of Docker, you'll have a secure, private VPN server running in just five simple steps. Let's get started!
Why Choose wg-easy for Your VPN?
Before we dive into the setup, let's clarify why wg-easy is the perfect choice for both beginners and experienced self-hosters.
- Simplicity: wg-easy abstracts away all the complexity of WireGuard. No more manual key generation or editing cryptic config files. Everything is managed through a clean web UI.
- Web-Based Management: Add, remove, enable, or disable client devices on the fly from any web browser. You can see connection statuses and download configurations with a single click.
- Effortless Client Setup: Adding a new phone or laptop is as simple as scanning a QR code with the official WireGuard app. It's a seamless experience.
- Docker-Powered: It runs in a lightweight, isolated Docker container, making installation, updates, and management incredibly straightforward and portable across any system with Docker.
- Built on WireGuard: You get all the benefits of the underlying WireGuard protocol: state-of-the-art cryptography, high performance, and a minimal codebase that enhances security.
Prerequisites for Setup
To ensure a smooth setup process, you'll need a few things ready. Don't worry, the requirements are minimal.
- A Server: This can be a cloud VPS (like DigitalOcean, Vultr, or Hetzner), a Raspberry Pi, a home server, or even an old PC. The key is that it's always on and connected to the internet.
- A Public IP Address: Your server needs to be reachable from the internet. A static IP is best, but a dynamic DNS (DDNS) service will also work perfectly.
- Docker and Docker Compose: These tools are essential for running wg-easy. If you don't have them, you can find simple installation guides for your OS online. Most Linux distributions have them in their standard repositories.
- Basic Command-Line Access: You'll need to run a few commands via SSH or a direct terminal on your server.
The 5-Step wg-easy Setup Guide
Ready to build your VPN? Follow these five steps, and you'll be up and running in minutes.
Step 1: Prepare Your Server Environment
First, log in to your server's terminal. It's good practice to create a dedicated directory for your Docker projects to keep things organized.
mkdir -p /opt/wg-easy
cd /opt/wg-easy
Next, ensure your server's firewall will allow VPN traffic. WireGuard uses a single UDP port. The default is 51820. If you use a firewall like `ufw` on Ubuntu, you can open the port with this command:
sudo ufw allow 51820/udp
sudo ufw allow 51821/tcp # For the web UI
Remember to also open these ports if you are using a cloud provider's firewall.
Step 2: Create the Docker Compose File
Docker Compose uses a YAML file to define and run multi-container Docker applications. Inside the `/opt/wg-easy` directory you just created, create a new file named `docker-compose.yml`:
nano docker-compose.yml
Now, copy and paste the following configuration into the file. Be sure to change the `WG_HOST` and `PASSWORD` values.
version: "3.8"
services:
wg-easy:
image: weejewel/wg-easy
container_name: wg-easy
environment:
# REQUIRED: The public IP or domain name of your server
- WG_HOST=your.server.ip.or.domain
# REQUIRED: The password for the web UI
- PASSWORD=YourSuperStrongPassword
# Optional:
- WG_PORT=51820
- WG_DEFAULT_ADDRESS=10.8.0.x
- WG_DEFAULT_DNS=1.1.1.1, 1.0.0.1
- WG_ALLOWED_IPS=0.0.0.0/0, ::/0
volumes:
- .:/etc/wireguard
ports:
- "51820:51820/udp"
- "51821:51821/tcp"
cap_add:
- NET_ADMIN
- SYS_MODULE
sysctls:
- net.ipv4.ip_forward=1
- net.ipv4.conf.all.src_valid_mark=1
restart: unless-stopped
Key Variables to Set:
WG_HOST
: This is crucial. Set this to your server's public IP address or a domain name that points to it.PASSWORD
: Choose a strong, unique password to protect your web UI.WG_DEFAULT_DNS
: (Optional) By default, it uses Cloudflare's DNS. You can change this to your preferred DNS provider or your Pi-hole's IP address.
Save and close the file (CTRL+X
, then `Y`, then `Enter` in nano).
Step 3: Launch the wg-easy Container
With the configuration file in place, launching the VPN server is as simple as running one command from within the `/opt/wg-easy` directory:
docker-compose up -d
The `-d` flag runs the container in detached mode, meaning it will run in the background. Docker will now pull the wg-easy image and start the container. You can verify that it's running correctly with:
docker ps
You should see `wg-easy` listed in the output with a status of `Up`.
Step 4: Access the Web UI and Create a Client
Your VPN server is now running! Open a web browser and navigate to the web UI:
http://<your-server-ip>:51821
You'll be prompted for the password you set in the `docker-compose.yml` file. After logging in, you'll see a clean dashboard. Creating your first VPN client profile couldn't be easier:
- Click the big + New Client button.
- Give your client a descriptive name, like `My-iPhone` or `Work-Laptop`.
- Click Create.
That's it! A new client configuration has been generated and is ready to use.
Step 5: Connect Your Devices
wg-easy provides two simple ways to connect your devices.
- For Mobile Devices (iOS/Android): Download the official WireGuard app from the App Store or Google Play. In the wg-easy web UI, click the QR code icon next to your newly created client. In the WireGuard app, tap the '+' button and choose "Scan from QR code." Point your camera at the screen, and your device will be instantly configured.
- For Desktops (Windows/macOS/Linux): Download the official WireGuard client for your operating system. In the wg-easy web UI, click the download icon next to your client's name to save the `.conf` configuration file. In the WireGuard desktop client, click "Import tunnel(s) from file" and select the file you just downloaded.
Once imported, simply toggle the connection to 'On' in the app. You are now securely connected to your personal VPN! You can verify this by searching "what is my IP" on Google—it should now show your server's IP address.
wg-easy vs. Other VPN Solutions
How does wg-easy stack up against other popular choices? Here's a quick comparison.
Feature | wg-easy | OpenVPN (Self-Hosted) | Vanilla WireGuard (CLI) |
---|---|---|---|
Ease of Setup | Excellent (Docker Compose) | Moderate (Requires PKI setup) | Difficult (Manual key/config generation) |
Performance | Excellent (High-throughput) | Good (Slower than WireGuard) | Excellent (High-throughput) |
Client Management | Excellent (Web UI, QR Codes) | Moderate (Manual client certs) | Difficult (Manual config files) |
Protocol | WireGuard | OpenVPN | WireGuard |
Security | Excellent (Modern cryptography) | Excellent (Mature and audited) | Excellent (Modern cryptography) |
Advanced Configuration & Tips
wg-easy is powerful right out of the box, but here are a few tips to enhance your setup.
Ensuring Persistent Data
The `volumes` section in our `docker-compose.yml` file is critical:
volumes:
- .:/etc/wireguard
This line maps the container's configuration directory (`/etc/wireguard`) to the current directory on your host machine (`/opt/wg-easy`). This means all your client configurations and server keys are stored safely on your server, even if you update or restart the container.
Customizing DNS for Ad-Blocking
Want to block ads and trackers across all your devices connected to the VPN? If you run a network-wide ad-blocker like Pi-hole or AdGuard Home, you can route all your VPN DNS traffic through it. Simply find the IP address of your ad-blocker on your local network and update the `WG_DEFAULT_DNS` variable:
- WG_DEFAULT_DNS=192.168.1.10 # Your Pi-hole's IP
After changing the `docker-compose.yml` file, restart the container for the changes to take effect:
docker-compose down && docker-compose up -d
Troubleshooting Common Issues
- Can't connect from a client: Double-check that your `WG_HOST` variable is correct and that your firewall (both on the server and in your cloud provider's dashboard) has UDP port 51820 open.
- Web UI is not accessible: Confirm the container is running with `docker ps`. Ensure your firewall has TCP port 51821 open. Check the container logs with `docker logs wg-easy` for any error messages.
- Slow speeds: While WireGuard is fast, performance can be limited by your server's CPU and network connection. This is rarely an issue on modern hardware.
Conclusion: Take Control of Your Digital Privacy
Congratulations! You have successfully deployed a secure, high-performance VPN server using wg-easy and Docker. In just a few minutes, you've built a powerful tool that protects your internet traffic on public networks, shields your activity from your ISP, and gives you secure access to your home network from anywhere in the world.
By self-hosting your VPN, you've taken a significant step toward digital sovereignty. You are no longer reliant on a third-party service; you are in complete control. Enjoy the peace of mind that comes with a private, encrypted connection that you own and manage.