Self‑hosted authoritative DNS server + lightweight management panel · Supports multiple record types
| Layer | Technology |
|---|---|
| Backend | PHP 7.4+, SQLite (WAL mode + retry mechanism to prevent locking) |
| Frontend | Plain CSS (no frameworks), consistent layout, “back to top” button |
| Deployment | Debian/Ubuntu + Nginx + PHP‑FPM + SQLite3 |
| Dependencies | No Redis, no external cron (tasks simulated via register_shutdown_function or polling) |
| Feature | Description |
|---|---|
| Registration / Login | Supports email verification (SMTP), invitation‑code registration (toggleable in admin panel), and password recovery via email. |
| Domain Management | Add, delete, and edit domains (supports multiple record types). |
| Record Management | Add/edit/delete DNS records for a domain. Supported types: A, AAAA, CNAME, MX, TXT, NS, SRV, CAA, SOA (editable). Fields appear dynamically based on the type (e.g., MX requires priority and target; SRV requires service, protocol, port, weight, priority, etc.). Supports pagination, fuzzy search (by domain, record type, content), and adjustable items per page. |
| API Management | Generate an API Key (one per user), set IP whitelists (only whitelisted IPs can call the API), and enforce rate limiting (globally configured by admin). |
| Security Settings | Users can enable “operation confirmation code”. Sensitive actions (deleting a domain or record) will then require a confirmation code sent to their email (via SMTP). |
| Profile | Change email (with verification), password, and backup email. |
| Invitation Codes | Users can generate invitation codes (quota controlled by admin) for others to register. |
| Announcements | Homepage shows unread announcement reminders; clicking displays full details. |
| Abuse Reporting | Users can submit reports (domain, record, reason) for admin handling. |
| Feature | Description |
|---|---|
| User Management | View all users (pagination, search, ban/unban/delete). Promote ordinary users to administrators. Click on a user to view their domains and record lists. |
| Administrator Management | Add new administrators (directly by email) or promote existing users. |
| System Configuration | Global parameters: primary domain, site title, window title, subtitle, homepage content (English only); Security: IP whitelist (on/off), rate limit (requests/second); Registration mode: open / invitation‑only / closed; Email whitelist (restrict allowed email suffixes); Footer, Terms of Service, Privacy Policy (support HTML); Allowed record types (admin can enable/disable which types users may add; all enabled by default). |
| System Email | Configure SMTP server (sending email, password, server, port, encryption) for verification codes, etc. |
| Invitation Code Management | View all invitation codes (with usage status) and batch‑generate admin invitation codes. |
| Announcement Management | Publish, edit, and delete announcements (rich‑text supported). Unread indicators shown on the frontend. |
| Data Backup / Restore | Manual backup of SQLite database (export as .sql or .db file) and one‑click import restore (automatically rebuilds tables). |
| Report Management | View all reports, mark their handling status, and optionally send email feedback to the reporter. |
| Admin Settings | Change the admin login second‑factor confirmation code (current preset password + fixed confirmation code; old code required for changes). |
| Audit Logs | All operation logs (user logins, modifications, deletions, etc.) are written to a single file (e.g., logs/godns.log). Administrators can view and search logs online. |
users – id, email, password_hash, role (0=admin, 1=ordinary), status, api_key, api_whitelist (JSON), confirm_code_enabled, reg_ip, created_at...
domains – id, user_id, domain_name, created_at, updated_at
records – id, domain_id, record_type, name, ttl, content, extra(JSON) -- dynamic fields stored in extra
invite_codes – id, code, user_id (generator), used_by, used_at, created_at, expires_at
announcements– id, title, content, is_visible, created_at
reports – id, user_id, domain_id, record_id, reason, status, handled_by, handled_at
settings – key, value (stores all configuration items)
logs – id, level, user_id, ip, action, detail, created_at (may also be written directly to a file)
PRAGMA journal_mode=WAL;busy errors.| Measure | Description |
|---|---|
| Injection Prevention | PDO prepared statements used; all user input is sanitised. |
| XSS / CSRF | Output escaping; CSRF tokens used in forms. |
| Second‑Factor Confirmation Code | Admin login: requires preset password + a fixed confirmation code (changeable in admin settings). User sensitive operations: if enabled, the user must enter a 6‑digit code sent to their email (valid for 5 minutes). |
| IP Whitelist | Enforced for all API calls; can be globally toggled by admin. |
| Rate Limiting | Request counting per IP (stored in SQLite); returns HTTP 429 when limit is exceeded. |
apt update && apt install -y nginx php-fpm php-sqlite3 php-json php-mbstring php-session sqlite3 git
cd /var/www
git clone https://github.com/yourname/godns.git
cd godns
chown -R www-data:www-data /var/www/godns
chmod 755 /var/www/godns
mkdir -p /var/www/godns/logs /var/www/godns/data
chmod 755 /var/www/godns/logs /var/www/godns/data
Create /etc/nginx/sites-available/godns.conf:
server {
listen 80;
server_name your-domain.com;
root /var/www/godns/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Enable the site and restart Nginx:
ln -s /etc/nginx/sites-available/godns.conf /etc/nginx/sites-enabled/
nginx -t && systemctl restart nginx
http://your-domain.com. The system detects that the database does not exist and runs the installation script:
0 3 * * * /usr/bin/php /var/www/godns/cli/backup.php
settings table; administrators can modify them via the backend – no need to edit configuration files.config/config.php.?route=user/login).Remarks: This document fully supports multiple record types while retaining all previous adjustments (no control panel, multiple administrators, 30‑user scope, English‑only interface, no mass email feature). The development can prioritise five common types (A, AAAA, CNAME, MX, TXT, NS) and implement the rest later.
📅 Last updated: August 2026
自托管权威 DNS 服务器 + 轻量管理面板 · 支持多记录类型
| 层级 | 技术 |
|---|---|
| 后端 | PHP 7.4+,SQLite 数据库(WAL 模式 + 重试机制防锁) |
| 前端 | 纯 CSS(无框架),统一布局,含“回到顶部”按钮 |
| 部署环境 | Debian/Ubuntu + Nginx + PHP‑FPM + SQLite3 |
| 依赖 | 无 Redis,无外部 cron(任务通过 register_shutdown_function 或轮询模拟) |
| 功能 | 说明 |
|---|---|
| 注册/登录 | 支持邮箱验证(需 SMTP)、邀请码注册(后台开关)、密码找回(邮件) |
| 域名管理 | 增删改域名,支持多种记录类型 |
| 记录管理 | 增删改 DNS 记录,支持 A, AAAA, CNAME, MX, TXT, NS, SRV, CAA, SOA;字段动态展示(如 MX 需优先级和目标,SRV 需服务、协议、端口等)。支持分页、模糊搜索(域名/类型/内容),可调每页条数 |
| API 管理 | 生成 API Key(每用户一个)、设置 IP 白名单、速率限制(全局配置) |
| 安全设置 | 开启“操作确认码”:敏感操作(删除域名/记录)需邮件发送的 6 位验证码 |
| 个人资料 | 修改邮箱(需验证)、密码、备用邮箱 |
| 邀请码 | 生成邀请码(管理员控制配额)供他人注册 |
| 公告 | 首页显示未读提醒,点击查看完整内容 |
| 举报 | 用户可提交举报(域名、记录、原因)供管理员处理 |
| 功能 | 说明 |
|---|---|
| 用户管理 | 查看所有用户(分页/搜索)、封禁/解封/删除;提升管理员;点击查看其域名和记录 |
| 管理员管理 | 直接通过邮箱添加管理员,或提升现有用户 |
| 系统配置 | 全局参数:主域名、站点标题、窗口标题、副标题、首页内容(仅英文); 安全:IP 白名单开关、速率限制(请求/秒); 注册模式:开放/邀请/关闭; 邮箱白名单(限制后缀); 页脚、服务条款、隐私政策(支持 HTML); 允许的记录类型(管理员可启用/禁用,默认全部开启) |
| 系统邮件 | 配置 SMTP 服务器(发件邮箱、密码、服务器、端口、加密方式) |
| 邀请码管理 | 查看所有邀请码及使用状态,批量生成管理员邀请码 |
| 公告管理 | 发布、编辑、删除公告(支持富文本),前台显示未读标记 |
| 数据备份/恢复 | 手动备份 SQLite 数据库(导出 .sql 或 .db),一键导入恢复(自动重建表) |
| 举报管理 | 查看所有举报,标记处理状态,可选择邮件反馈给举报人 |
| 管理员设置 | 修改管理员登录二次确认码(当前预设密码 + 固定确认码,更改需旧码) |
| 审计日志 | 所有操作日志(登录、修改、删除等)写入 logs/godns.log,管理员可在线查看和搜索 |
users – id, email, password_hash, role, status, api_key, api_whitelist(JSON), confirm_code_enabled, reg_ip, created_at...
domains – id, user_id, domain_name, created_at, updated_at
records – id, domain_id, record_type, name, ttl, content, extra(JSON) -- 动态字段存储在 extra
invite_codes – id, code, user_id(生成者), used_by, used_at, created_at, expires_at
announcements– id, title, content, is_visible, created_at
reports – id, user_id, domain_id, record_id, reason, status, handled_by, handled_at
settings – key, value (所有配置项)
logs – id, level, user_id, ip, action, detail, created_at (也可直接写入文件)
PRAGMA journal_mode=WAL;busy 错误。| 措施 | 说明 |
|---|---|
| 注入防护 | PDO 预处理,所有输入过滤 |
| XSS / CSRF | 输出转义,表单使用 CSRF Token |
| 二次确认码 | 管理员登录:预设密码 + 固定确认码(后台可改); 用户敏感操作:邮件发送 6 位数字码(有效期 5 分钟) |
| IP 白名单 | 对所有 API 调用生效,可全局开关 |
| 速率限制 | 按 IP 计数(存于 SQLite),超限返回 HTTP 429 |
apt update && apt install -y nginx php-fpm php-sqlite3 php-json php-mbstring php-session sqlite3 git
cd /var/www
git clone https://github.com/yourname/godns.git
cd godns
chown -R www-data:www-data /var/www/godns
chmod 755 /var/www/godns
mkdir -p /var/www/godns/logs /var/www/godns/data
chmod 755 /var/www/godns/logs /var/www/godns/data
创建 /etc/nginx/sites-available/godns.conf:
server {
listen 80;
server_name your-domain.com;
root /var/www/godns/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
启用并重启 Nginx:
ln -s /etc/nginx/sites-available/godns.conf /etc/nginx/sites-enabled/
nginx -t && systemctl restart nginx
http://your-domain.com,系统检测到数据库不存在,自动运行安装脚本:
0 3 * * * /usr/bin/php /var/www/godns/cli/backup.php
settings 表,管理员后台修改,无需编辑配置文件。config/config.php。?route=user/login)。备注:本文档完整支持多记录类型,同时保留了所有前期调整(无面板、多管理员、30 用户规模、英文界面、无群发邮件)。开发可优先实现 A、AAAA、CNAME、MX、TXT、NS 六种常用类型,其余后续迭代。
📅 最后更新:2026 年 8 月