Understand AnQi CMS - System file structure
Understand the complete directory structure of AnQiCMS after installation, master the specific functions of each key directory and file such as the main program, configuration files, template directories, attachment directories, and runtime data, convenient for subsequent daily maintenance and secondary development.
AnQiCMS complete directory structure overview, take you to understand the use of each directory and file.
1. Top-level directory structure
anqicms/ # 网站根目录
├── anqicms # 主程序可执行文件(Linux/Mac)
├── anqicms.exe # 主程序可执行文件(Windows)
├── config.json # 配置文件(端口、数据库、站点名称等)
├── config.sample.json # 配置示例文件(首次启动自动复制为 config.json)
├── template/ # 🎯 模板目录(重点,见下文详解)
├── public/ # 🎯 Web 根目录(Nginx 运行目录,见下文详解)
├── data/ # 数据目录
│ ├── backup/ # 数据库备份文件
│ ├── cert/ # 支付证书文件
│ └── logs/ # 运行日志
├── cache/ # 缓存目录(文件缓存、模板缓存)
├── locales/ # 国际化语言包
│ ├── zh-CN/ # 简体中文
│ ├── en-US/ # 英文
│ ├── ja-JP/ # 日文
│ ├── ru-RU/ # 俄文
│ ├── pt-BR/ # 葡萄牙文
│ ├── id-ID/ # 印尼文
│ └── bn-BD/ # 孟加拉文
├── dictionary.txt # 中文分词词典(全文搜索用)
├── CHANGELOG.md # 版本更新日志
├── README.md # 项目说明
└── License # AGPL-3.0 开源协议
Note: Only the necessary directories visible after unpacking the compiled package (release mode). The cloned source code directory from GitHub contains more development-related files (
controller//model//go.modWait), can be deleted during production environment deployment.
Second, detailed explanation of template directory (template/)
template/It is the root directory of AnqiCMS templates, each template has an independent subdirectory. The system identifies and loads the template throughconfig.json。”“Identification and loading of templates.
2.1 Template configuration file config.
Each template directory containsconfig.json. It is automatically generated by default and can be manually modified. The content format is as follows:
{
"name": "默认模板",
"package": "default",
"version": "1.0",
"description": "系统默认模板",
"author": "kandaoni.com",
"homepage": "https://www.kandaoni.com",
"created": "2022-05-10 22:29:00",
"template_type": 0,
"status": 0
}
| field | Type | Required | Description |
|---|---|---|---|
name |
string | No | Template display name, leave blank to automatically take the directory name |
package |
string | No | Template folder name, only supports letters and numbers |
version |
string | No | Template version number |
description |
string | No | Template Introduction Description |
author |
string | No | Template author |
homepage |
string | No | Author's Website Address |
created |
string | No | Creation Time, Format2006-01-02 15:04:05 |
template_type |
int | No | 0=Adaptive,1=Code Adaptation,2=Computer + Mobile |
status |
int | No | 0=Not enabled,1=Enabled (only one set can be 1) |
2.2 Template File Organization Mode
AnqiCMS supports folder mode organization by default.
Folder mode
template/mytemplate/
├── config.json # 模板配置文件(必须)
├── base.html # 公共基础模板(页头/页脚等公共布局)
├── partial/ # 代码片段目录
│ ├── header.html # 页头(导航、Logo)
│ ├── footer.html # 页脚(版权、备案号)
│ ├── sidebar.html # 侧边栏
│ └── pagination.html # 分页组件
│
├── index/
│ └── index.html # 首页
│
├── archive/ # 文章模型(默认模型 table=archive)
│ ├── index.html # 文章模型首页
│ ├── list.html # 文章列表页
│ ├── list-{分类ID}.html # 特定分类的列表页(如 list-5.html)
│ ├── detail.html # 文章详情页
│ └── detail-{文档ID}.html # 特定文档的详情页(如 detail-1.html)
│
├── product/ # 产品模型(table=product)
│ ├── index.html # 产品模型首页
│ ├── list.html # 产品列表页
│ ├── list-{分类ID}.html # 特定产品分类列表页
│ ├── detail.html # 产品详情页
│ └── detail-{文档ID}.html # 特定产品详情页
│
├── page/ # 单页面
│ ├── detail.html # 单页面详情页
│ └── {Url别名}.html # 特定单页面(如 detail-about.html)
│
├── tag/
│ ├── index.html # 标签首页
│ └── list.html # 标签文档列表页
│
├── comment/
│ └── list.html # 评论列表页
│
├── guestbook/
│ └── index.html # 在线留言页
│
├── search/
│ └── index.html # 搜索页
│
├── errors/
│ ├── 404.html # 404 错误页
│ ├── 500.html # 500 错误页
│ └── close.html # 站点关闭提示页
│
└── mobile/ # 手机端模板目录(template_type=2 时使用)
├── index/
│ └── index.html
├── archive/
│ ├── list.html
│ └── detail.html
└── ... # 结构同 PC 端
2.3 Template file and page matching rules
| Page type | Folder mode path |
| Home | index/index.html |
|
| Model homepage | {模型table}/index.html |
|
| Document List | {模型table}/list.html |
|
| Document details | {模型table}/detail.html |
|
| Category list (independent template) | {模型table}/list-{分类ID}.html |
|
| Document details (independent template) | {模型table}/detail-{文档ID}.html |
|
| single page | page/detail.html |
|
| Single page (independent template) | page/{Url别名}.html |
|
| Tag homepage | tag/index.html |
|
| Tag list | tag/list.html |
|
| Comment List | comment/list.html |
|
| Message page | guestbook/index.html |
|
| Search Page | search/index.html |
|
| 404 Error | errors/404.html |
|
| 500 Error | errors/500.html |
|
| Site Closure | errors/close.html |
{模型table}Is defined in the content modeltable_nameThe default article model isarchive, Product Model isproduct.
2.4 Template naming specification
| Rule | Description |
|---|---|
| File encoding | Must be usedUTF-8 (no BOM)Otherwise, the page will be garbled |
| file suffix | All template files use.htmlsuffix |
| Variable naming | UseCamel case naming(Capitalize the first letter), such as{{archive.Title}} |
| Custom template | detail-{ID}.htmlandlist-{ID}.htmlCan set an independent template for specific documents/categories |
Chapter 3: Detailed Explanation of Web Root Directory (public/)
public/It is the Web root directory that must be pointed to when using Nginx reverse proxy, containing all statically accessible resources.
anqicms/public/
├── static/ # 静态资源目录
│ ├── default/ # 模板对应文件夹
│ │ ├── css/ # 模板样式文件
│ │ │ ├── style.css
│ │ │ └── ...
│ │ ├── js/ # JavaScript 文件
│ │ │ ├── main.js
│ │ │ └── ...
│ │ └── images/ # 图片资源
│ │ ├── logo.png
│ │ └── ...
├── uploads/ # 上传资源目录(用户上传的图片/文件)
│ ├── images/ # 按年/月自动归档
│ │ ├── 2026/
│ │ │ ├── 01/
│ │ │ ├── 02/
│ │ │ └── ...
│ │ └── ...
├── robots.txt # 爬虫规则(后台可配置)
├── sitemap.xml # Sitemap 索引文件(自动生成)
└── LLMs.txt # AI 索引文件(后台可配置)
Chapter 4: The Necessity of Each Directory/File in the Production Environment
| Directory/File | Essential for production? | Description |
|---|---|---|
anqicms(Executable File) |
✅ Essential | The program itself, without which it cannot run |
config.json |
✅ Essential | Configuration file, without which the program does not know the port and database |
template/ |
✅ Essential | Template file, without which the front-end cannot display |
public/ |
✅ Essential | The root directory of the web, the target of Nginx |
data/ |
✅ Essential | Running data (backups, caches, logs) |
cache/ |
✅ Essential | Cache directory |
locales/ |
✅ Essential | Multilingual packages |
dictionary.txt |
✅ Essential | Chinese word segmentation dictionary |
CHANGELOG.md/README.md/License |
❌ Can be deleted | Pure document files |
Fifth, security reminder: configure the root directory of public/
Make sure to ensure that the Nginx configuration containsrootPoint topublic/directory, notanqicms/Root directory:
# ❌ 错误 —— 用户可直接访问 config.json、template/ 等敏感文件
root /data/wwwroot/anqicms;
# ✅ 正确 —— 外部只能访问 public/ 下的资源
root /data/wwwroot/anqicms/public;