科学上网 5/9/2026 阅读 90大约 8 分钟

Debian 12 安装 OpenVPN Web UI(Access Server 教程)

Author
小李分享站
Cover

在 Debian 12 上部署带 Web 管理界面的 OpenVPN,最省事的方案就是用官方的 OpenVPN Access Server(AS)。

它自带完整 Web 后台(管理 + 用户),不需要自己折腾各种老旧 WebUI。

为什么用 Access Server

  • 自带 Web 管理界面(Admin + Client)
  • 支持用户管理 / 证书分发 / 一键下载客户端
  • 免费版支持 2 个同时在线设备(个人够用)
  • 稳定、官方维护,兼容 Debian 12

一键安装(Debian 12)

1. 更新系统

sudo apt update && sudo apt upgrade -y
sudo apt install -y ca-certificates wget net-tools gnupg curl

2. 添加官方源

添加 GPG 密钥

curl -fsSL https://as-repository.openvpn.net/as-repo-public.asc | sudo tee /etc/apt/trusted.gpg.d/openvpn-as.asc >/dev/null

添加软件源

echo "deb [signed-by=/etc/apt/trusted.gpg.d/openvpn-as.asc] http://as-repository.openvpn.net/as/debian bookworm main" | sudo tee /etc/apt/sources.list.d/openvpn-as.list
sudo apt update

3. 安装 OpenVPN AS

sudo apt install -y openvpn-as

安装完成后会输出:

  • Admin 管理后台:https://你的IP:943/admin
  • 用户登录地址:https://你的IP:943/
  • 用户名:openvpn
  • 密码:安装时生成(终端里)

👉 第一件事:登录后修改密码

登录后台

浏览器打开:

https://你的服务器IP:943/admin

首次登录会强制改密码。

基础设置(建议)

后台里改这几个就够用了:

  • VPN 网段默认:172.27.224.0/20(可改)
  • 流量是否全走 VPNVPN Settings → Routing
  • 创建用户User Management → 添加账号给别人用

客户端下载入口:

https://你的IP:943/

防火墙放行

如果你开了防火墙,记得放端口:

sudo ufw allow 943/tcp
sudo ufw allow 1194/udp

常用命令

# 状态
sudo systemctl status openvpnas# 重启
sudo systemctl restart openvpnas# 修改密码
sudo passwd openvpn# 卸载
sudo apt purge openvpn-as


(推荐)换成 HTTPS 证书(Let’s Encrypt)

默认是自签名证书,会提示“不安全”。

1. 安装 Certbot

sudo apt install -y certbot

2. 申请证书

sudo certbot certonly --standalone \
-d 你的域名 \
--email 你的邮箱 \
--agree-tos --non-interactive
#如果端口占用
sudo systemctl stop openvpnas

3. 证书位置

/etc/letsencrypt/live/你的域名/

用到两个文件:

  • fullchain.pem
  • privkey.pem

4. 上传到 WebUI

后台路径:

Configuration → Web Server

填写:

  • Certificate:fullchain.pem
  • Private Key:privkey.pem

保存 → Update Running Server

5. 自动更新(可选)

sudo /usr/local/openvpn_as/scripts/sacli \
--key cs.cert \
--value_file /etc/letsencrypt/live/你的域名/fullchain.pem ConfigPutsudo /usr/local/openvpn_as/scripts/sacli \
--key cs.priv_key \
--value_file /etc/letsencrypt/live/你的域名/privkey.pem ConfigPutsudo /usr/local/openvpn_as/scripts/sacli start

总结

这套方案基本就是:

  • 安装 → 打开网页 → 创建用户 → 下载客户端 → 直接用

如果只是自己用或小团队,用 Access Server 就够了,不用折腾那些老旧 WebUI。

这篇教程对你有帮助吗?

你的支持是我继续分享的动力!

关注我

评论区 (0)

暂无评论,快来抢沙发吧~