
Wg-Easy also known as WireGuard-easy is an open-source web-based graphical interface for WireGuard VPN to manage configurations, clients, and VPN connections. Wg-Easy includes all required WireGuard tools used to create multiple VPN interaces and client configurations on a server.
This article explains how to install Wg-Easy on Ubuntu 24.04 to create and manage WireGuard VPN connections.
Before you begin:
wg-easy.example.com.Wg-Easy runs as a Docker container to manage WireGuard VPN interfaces, users, and connections on a server. Follow the steps below to verify that Docker is installed, add your current user to the Docker group, and install Wg-Easy.
View the Docker service status and verify that it's running.
Output:
If you receive a docker service not found error, run the following command to install Docker and Docker compose.
If the Docker service is inactive, run the following command to start Docker.
Print your current user.
Your output should be similar to the one below:
Add your active user to the Docker group. Replace linuxuser with your actual user.
Enter a new shell to apply the user group changes.
Create a new administrator password using the htpasswd utility with a bcrypt hash value to use with Wg-Easy.
Copy the generated hashed password in your output similar to the one below.
Docker CLI installs Wg-Easy in a single command with minimal environment configuration options. Follow the steps below to install Wg-Easy using Docker CLI on your server.
Pull the Wg-Easy image.
Install Wg-Easy using Docker CLI. Replace wg-easy.example.com with your actual domain and add your hashed password as the PASSWORD_HASH value.
Save and close the file.
The above Docker CLI command creates a new wg-easy container to manage WireGuard connections on the server. Within the Docker CLI command:
--name wg-easy: Sets the Docker container name.--env LANG=en: Enables English as the default language in the Wg-Easy web management interface.--env WG_HOST=wg-easy.example.com: Enables Wg-Easy to listen for network connections using the specified domain or server IP address.--env PASSWORD_HASH: Sets the administrator password used to access the Wg-Easy interface.--env PORT=51821: Sets the Wg-Easy port used to access the web management interface.--env WG_PORT=51820: Sets the default WireGuard connections port.--volume ~/.wg-easy:/etc/wireguard: Forwards WireGuard configurations in the wg-easy directory in your user home directory to the container's /etc/wireguard directory.--sysctl 'net.ipv4.ip_forward=1: Enables network forwarding to allow WireGuard clients to access the Internet and other external networks through the server.View all active Docker containers and verify that the wg-easy container is running.
Output:
Docker Compose allows you to customize and install Wg-Easy with advanced configurations including the forwarding of specific files such as WireGuard configurations from the server to the wg-easy container. Follow the steps below to install Wg-Easy using Docker Compose.
Switch to your user's home directory.
Create a new wg-easy.yml configuration file using a text editor such as nano.
Add the following configurations to the file. Replace the hash password with your actual password.
Save the file.
The above Docker Compose configuration installs Wg-Easy with specific environment options and forwards configuration files from the /etc/wireguard directory on the server to the /etc/wireguard in the Wg-Easy container.
Apply the Docker Compose configuration to install and run Wg-Easy in detached mode.
Output:
View all active Docker containers and verify that the Wg-Easy container is running.
Output:
Nginx Proxy Manager is a reverse proxy application that forwards external connections to internal applications or services in a Docker environment. Follow the steps below to install Nginx Proxy Manager and secure the Wg-Easy web management interface using your wg-easy.example.com domain and generate trusted SSL certificates on the server.
Create a new nginx-proxy.yml configuration file.
Add the following configurations to the nginx-proxy.yml file.
Save and close the file.
The above Docker Compose configuration installs Nginx Proxy Manager to manage network connections using HTTP and HTTPS ports. Within the configuration:
image: 'jc21/nginx-proxy-manager:latest': Sets the Nginx Proxy Manager Docker image version to install.container_name: nginx-proxy-man: Sets the Nginx Proxy Manager container name for identification and management purposes.- '80:80': Forwards the container port 80 to the server port 80 to enable HTTP network connections.- '443:443': Forwards the container port 443 to the server port 443 to enable HTTPS network connections.- '81:81': Forwards the container port 81 to the server port 81 to enable access to the Nginx Proxy Manager web management interface../data:/data: Mounts the data directory from the server to the container.- ./letsencrypt:/etc/letsencrypt: Mounts Let's Encrypt SSL certificates from the active project directory to the container.Apply the Docker Compose configuration to install Nginx Proxy Manager.
Output:
View all active Docker containers and verify that Nginx Proxy Manager is running.
Output:
Create a new Docker network to connect the Nginx Proxy Manager container to Wg-Easy.
List all Docker networks and verify that the wg-easy network is available.
Output:
Attach the Nginx Proxy Manager container to the wg-easy network.
Attach the Wg-Easy container to the wg-easy network.
Nginx Proxy Manager generates SSL certificates using Let's Encrypt and forwards network connections to internal ports in a Docker network. Follow the steps below to access the Nginx Proxy Manager interface, forward connections to the Wg-Easy container, and generate trusted SSL certificates using your wg-easy.example.com domain.
Allow network connections to the HTTP port 80, HTTPS port 443, and Nginx Proxy Manager port 81 through the default firewall.
Reload UFW to apply the firewall configuration changes.
Access the Nginx Proxy Manager port 81 using your server's IP address in a web browser such as Chrome.
Enter the following administrator credentials to log in to Nginx Proxy Manager.
admin@example.comchangeme
Replace the default administrator credentials when prompted to secure Nginx Proxy Manager.
Click Hosts on the main navigation menu and select Proxy Hosts from the list of options.
Click Add Proxy Host to create a new reverse proxy connection.
Enter your domain name and keep http as the connection scheme.
Enter the Wg-Easy container name in the Forward Hostname/IP field and its web management port 51821 in the Forward Port field.
Turn on the Block Common Exploits and Websockets Support options to secure the reverse proxy connection.
Keep Publicily Accessible as the Access List value and navigate to the SSL tab to manage the domain's SSL certificate.
Click the SSL Certificate drop-down and select Request for a new SSL Certificate with Let’s Encrypt from the list of options.
Enter your active email in the Email Address field and click to agree to the Let's Encrypt terms of use.
Click Save to apply the reverse proxy configuration and generate a new SSL certificate.
Click your domain in the Proxy Hosts list and verify that you can access the Wg-Easy login page.
Follow the steps below to access Wg-Easy and create a new WireGuard client to connect to the server.
Access Wg-Easy using your wg-easy.example.com domain.
Enter the administrator password you hashed during installation to log in to the Wg-Easy interface.
Click New Client to create a new WireGuard client.
Enter a new client name and click Create.
Verify that the new client is created and click Download Configuration to download the client's WireGuard configuration file.
Click the QR Code option to reveal a QR Code to scan and connect mobile device clients to the WireGuard server.
Follow the steps below to connect a WireGuard desktop client to the Wg-Easy server and verify that the user can access the Internet through the server.
Create a new WireGuard client and download the client configuration from the Wg-Easy interface to connect the client.
Download the WireGuard client package for your device. For example, WireGuard for macOS.
Open WireGuard from your applications menu.
Click Manage Tunnels to open the WireGuard configuration interface.
Click the Add Tunnel drop-down, and select Import Tunnel(s) from File to browse and open your WireGuard client configuration.
Verify that a new WireGuard tunnel is available and click Activate to connect to the Wg-Easy server.
Verify that the connection is active and open the Wg-Easy management interface to view the network statistics.
Monitor and manage the WireGuard client's network usage information.
You have installed Wg-Easy and managed WireGuard clients on Ubuntu 24.04 using Docker. You can create multiple WireGuard clients, assign multiple network addresses, enable and disable connections using the Wg-Easy management interface. In addition, you can integrate Wg-Easy with existing WireGuard configurations to manage multiple connections and hosts on your server. For more information and configuration options, please visit the Wg-Easy project repository.
0 Comments
Be the first to comment and share your perspective with the community.