25
2025
02
21:33:23

基于docker WireGuard Easy webgui

https://github.com/wg-easy/wg-easy  


WireGuard Easy

Build & Publish Docker Image to Docker Hub Lint Docker Sponsor GitHub Stars

You have found the easiest way to install & manage WireGuard on any Linux host!

Features

  • All-in-one: WireGuard + Web UI.

  • Easy installation, simple to use.

  • List, create, edit, delete, enable & disable clients.

  • Show a client's QR code.

  • Download a client's configuration file.

  • Statistics for which clients are connected.

  • Tx/Rx charts for each connected client.

  • Gravatar support.

  • Automatic Light / Dark Mode

  • Multilanguage Support

  • Traffic Stats (default off)

  • One Time Links (default off)

  • Client Expiry (default off)

  • Prometheus metrics support

Requirements

  • A host with a kernel that supports WireGuard (all modern kernels).

  • A host with Docker installed.

Versions

? For the stable version please read instructions on the production branch!

We provide more than 1 docker image tag, the following will help you decide which one suites the best for you.

tagBranchExampleDescription
latestproductionghcr.io/wg-easy/wg-easy:latest or ghcr.io/wg-easy/wg-easystable as possbile get bug fixes quickly when needed, deployed against production.
14productionghcr.io/wg-easy/wg-easy:14same as latest, stick to a version tag.
nightlymasterghcr.io/wg-easy/wg-easy:nightlymostly unstable gets frequent package and code updates, deployed against master.
developmentpull requestsghcr.io/wg-easy/wg-easy:developmentused for development, testing code from PRs before landing into master.

Installation

1. Install Docker

If you haven't installed Docker yet, install it by running:

curl -sSL https://get.docker.com | sh sudo usermod -aG docker $(whoami) exit

| sh sudo usermod -aG docker $(whoami) exit" tabindex="0" role="button" style="box-sizing: border-box;position: relative;font-size: 14px;font-weight: var(--base-text-weight-medium, 500);line-height: 20px;text-wrap: nowrap;vertical-align: middle;cursor: pointer;user-select: none;border: 0px;border-radius: 6px;appearance: none;color: var(--fgColor-accent, var(--color-accent-fg));box-shadow: none;transition: color 80ms cubic-bezier(0.33, 1, 0.68, 1) 0s, background-color 0s ease 0s, box-shadow 0s ease 0s, border-color 0s ease 0s;width: var(--control-small-size, 28px);height: var(--control-small-size, 28px);display: flex !important;padding: 0px !important;justify-content: center !important;align-items: center !important">| sh sudo usermod -aG docker $(whoami) exit" tabindex="0" role="button" style="box-sizing: border-box;position: relative;font-size: 14px;font-weight: var(--base-text-weight-medium, 500);line-height: 20px;text-wrap: nowrap;vertical-align: middle;cursor: pointer;user-select: none;border: 0px;border-radius: 6px;appearance: none;color: var(--fgColor-accent, var(--color-accent-fg));box-shadow: none;transition: color 80ms cubic-bezier(0.33, 1, 0.68, 1) 0s, background-color 0s ease 0s, box-shadow 0s ease 0s, border-color 0s ease 0s;width: var(--control-small-size, 28px);height: var(--control-small-size, 28px);display: flex !important;padding: 0px !important;justify-content: center !important;align-items: center !important">

And log in again.

2. Run WireGuard Easy

To automatically install & run wg-easy, simply run:

docker run --detach \   --name wg-easy \   --env \   --env WG_HOST=<?YOUR_SERVER_IP> \   --env PASSWORD_HASH='<?YOUR_ADMIN_PASSWORD_HASH>' \   --env PORT=51821 \   --env WG_PORT=51820 \   --volume ~/.wg-easy:/etc/wireguard \   --publish 51820:51820/udp \   --publish 51821:51821/tcp \   --cap-add NET_ADMIN \   --cap-add SYS_MODULE \   --sysctl 'net.ipv4.conf.all.src_valid_mark=1' \   --sysctl 'net.ipv4.ip_forward=1' \   --restart unless-stopped \   ghcr.io/wg-easy/wg-easy

? Replace <?YOUR_SERVER_IP> with your WAN IP, or a Dynamic DNS hostname.

? Replace <?YOUR_ADMIN_PASSWORD_HASH> with a bcrypt password hash to log in on the Web UI. See How_to_generate_an_bcrypt_hash.md for instructions on how to generate a hashed password.

The Web UI will now be available on http://0.0.0.0:51821.

The Prometheus metrics will now be available on http://0.0.0.0:51821/metrics. Grafana dashboard 21733

? Your configuration files will be saved in ~/.wg-easy

WireGuard Easy can be launched with Docker Compose as well - just download docker-compose.yml, make necessary adjustments and execute docker compose up --detach.

3. Sponsor

Are you enjoying this project? Buy Emile a beer! ?
Donation to core component: WireGuard

Options

These options can be configured by setting environment variables using -e KEY="VALUE" in the docker run command.

EnvDefaultExampleDescription
PORT518216789TCP port for Web UI.
WEBUI_HOST0.0.0.0localhostIP address web UI binds to.
PASSWORD_HASH-$2y$05$Ci...When set, requires a password when logging in to the Web UI. See How to generate an bcrypt hash.md for know how generate the hash.
WG_HOST-vpn.myserver.comThe public hostname of your VPN server.
WG_DEVICEeth0ens6f0Ethernet device the wireguard traffic should be forwarded through.
WG_PORT5182012345The public UDP port of your VPN server. WireGuard will listen on that (othwise default) inside the Docker container.
WG_CONFIG_PORT5182012345The UDP port used on Home Assistant Plugin
WG_MTUnull1420The MTU the clients will use. Server uses default WG MTU.
WG_PERSISTENT_KEEPALIVE025Value in seconds to keep the "connection" open. If this value is 0, then connections won't be kept alive.
WG_DEFAULT_ADDRESS10.8.0.x10.6.0.xClients IP address range.
WG_DEFAULT_DNS1.1.1.18.8.8.8, 8.8.4.4DNS server clients will use. If set to blank value, clients will not use any DNS.
WG_ALLOWED_IPS0.0.0.0/0, ::/0192.168.15.0/24, 10.0.1.0/24Allowed IPs clients will use.
WG_PRE_UP...-See config.js for the default value.
WG_POST_UP...iptables ...See config.js for the default value.
WG_PRE_DOWN...-See config.js for the default value.
WG_POST_DOWN...iptables ...See config.js for the default value.
WG_ENABLE_EXPIRES_TIMEfalsetrueEnable expire time for clients
LANGendeWeb UI language (Supports: en, ua, ru, tr, no, pl, fr, de, ca, es, ko, vi, nl, is, pt, chs, cht, it, th, hi, ja, si).
UI_TRAFFIC_STATSfalsetrueEnable detailed RX / TX client stats in Web UI
UI_CHART_TYPE01UI_CHART_TYPE=0 # Charts disabled, UI_CHART_TYPE=1 # Line chart, UI_CHART_TYPE=2 # Area chart, UI_CHART_TYPE=3 # Bar chart
WG_ENABLE_ONE_TIME_LINKSfalsetrueEnable display and generation of short one time download links (expire after 5 minutes)
MAX_AGE01440The maximum age of Web UI sessions in minutes. 0 means that the session will exist until the browser is closed.
UI_ENABLE_SORT_CLIENTSfalsetrueEnable UI sort clients by name
ENABLE_PROMETHEUS_METRICSfalsetrueEnable Prometheus metrics http://0.0.0.0:51821/metrics and http://0.0.0.0:51821/metrics/json
PROMETHEUS_METRICS_PASSWORD-$2y$05$Ci...If set, Basic Auth is required when requesting metrics. See How to generate an bcrypt hash.md for know how generate the hash.

If you change WG_PORT, make sure to also change the exposed port.

Updating

To update to the latest version, simply run:

docker stop wg-easy docker rm wg-easy docker pull ghcr.io/wg-easy/wg-easy

And then run the docker run -d \ ... command above again.

With Docker Compose WireGuard Easy can be updated with a single command: docker compose up --detach --pull always (if an image tag is specified in the Compose file and it is not latest, make sure that it is changed to the desired one; by default it is omitted and defaults to latest).
The WireGuared Easy container will be automatically recreated if a newer image was pulled.

Common Use Cases

For less common or specific edge-case scenarios, please refer to the detailed information provided in the Wiki.




推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

本文链接:https://hqyman.cn/post/9173.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:
打赏





休息一下~~


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

请先 登录 再评论,若不是会员请先 注册

您的IP地址是: