Skip to main content

完全指南

完全指南

sudo apt install wireguard -y
ervices:
wg-gen-web:
image: vx3r/wg-gen-web:latest
container_name: wg-gen-web
restart: always
expose:
- "8080/tcp"
ports:
- 8081:8080
environment:
- WG_CONF_DIR=/data
- WG_INTERFACE_NAME=wg0.conf
- OAUTH2_PROVIDER_NAME=fake
- WG_STATS_API=http://172.17.0.1:8182
volumes:
- /etc/wireguard:/data
network_mode: bridge
wg-json-api:
image: james/wg-api:latest
container_name: wg-json-api
restart: always
cap_add:
- NET_ADMIN
network_mode: "host"
command: wg-api --device wg0 --listen 172.17.0.1:8182

reload

# /etc/systemd/system/wg-gen-web.service
[Unit]
Description=Restart WireGuard
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl reload wg-quick@wg0.service

[Install]
WantedBy=multi-user.target
# /etc/systemd/system/wg-gen-web.path
[Unit]
Description=Watch /etc/wireguard for changes

[Path]
PathModified=/etc/wireguard

[Install]
WantedBy=multi-user.target
systemctl enable wg-gen-web.service wg-gen-web.path --now