If you haven't installed Docker and Docker Compose, follow these steps:
sudo apt update
sudo apt install -y docker.io docker-compose
sudo systemctl enable --now dockerVisit the official Docker documentation and Docker Compose installation guide.
-
Create a new directory for your setup:
mkdir ~/wg-easy-setup cd ~/wg-easy-setup
-
Create the
docker-compose.ymlfile:nano docker-compose.yml
Paste the
docker-compose.ymlcontent into this file and save it.
Generate a password hash for secure access to the web interface. You can use the following command:
openssl passwd -6 your_password_hereReplace your_password_here with the password you want to use. Copy this hash and place it in the PASSWORD_HASH field in docker-compose.yml.
Generate a password hash for secure access to the web interface. You can use the following command:
docker run -it --rm ghcr.io/wg-easy/wg-easy wgpw YOUR_PASSWORDReplace YOUR_PASSWORD with the password you want to use. Copy this hash and place it in the PASSWORD_HASH field in docker-compose.yml.
If your hash contains $ signs, you must double them (e.g., $$)
Run the following command to start your containers:
docker-compose up -dCheck how its run:
docker compose logs -f wg-easyOpen your web browser and navigate to:
http://<your-server-ip>:8822
Log in using the password you set up using the generated password hash.
- Access the manager at http://:81.
- Create a Proxy Host.
- Domain Name: e.g., vpn.yourdomain.com.
- Forward Hostname: Use the container name wg-easy (if both are on the same Docker network) or your server's local IP.
- Forward Port: 8822.
- SSL: Use the built-in "Request a new SSL Certificate" to enable HTTPS via Let's Encrypt.
- Remove Public Port: Once your proxy is working, you can remove the 8822:8822
Once you're logged in, follow these steps to add a client:
- Go to the "Clients" section in the web interface.
- Click on "Add Client" and fill in the necessary details (name, DNS settings, etc.).
- Once created, download the configuration file for the client.
Depending on the operating system of your client devices:
- Download and install the WireGuard client from the official website.
- Import the downloaded configuration file.
sudo apt install wireguardThen, use the configuration file to set it up:
sudo mv ~/path/to/client.conf /etc/wireguard/
sudo wg-quick up client.conf- Download the WireGuard app from the Google Play Store or [Apple App Store](https://apps.apple.com/us/app/wire