ChanCMS

ChanCMS系列教程一:安装运行快速入门

2025-12-05 17:13:22 阅读(7115)

「导读」环境配置​前置条件:安装node.js mysql 和 mysql可视化工具。本地开发推荐用phpStudy。

快速入门​

环境配置​前置条件:安装node.js mysql 和 mysql可视化工具。本地开发推荐用phpStudy。

注意:版本有要求

nodejs v22.18.0(强烈建议保持一致)
pm2 v6.0.8
mysql v5.7.26(兼容v5.6)

项目地址

https://gitee.com/chancms/ChanCMS

文件结构


|- app
    |- helper      //工具函数
    |- common      //业务逻辑(分页, 文件上传等)
    |- extend      //第三方包扩展(可选)
    |- middleware  //全局中间件
    |- modules     //多模块mvc
        |- api 
            |- controller 
            |- service 
            |- guard  //权限控制 (可选) 
            |- middleware  //模块中间件 (可选)
            |- model  //数据库模型 (可选)
            |- view //模板文件 (可选)
            |- router.js 
        |- base 
            |- controller 
            |- service 
            |- view 
            |- router.js
        |- cms 
            |- controller 
            |- service 
            |- view 
            |- router.js
        |- web 
            |- controller 
            |- service 
            |- view 
            |- router.js
    |- plugin //插件(可选)
        |- plus-module1 
            |- controller 
            |- service 
            |- view 
            |- router.js 
        |- module2 
            |- controller 
            |- service 
            |- view 
            |- router.js
|- config 
|- public
|- index.js
|-.env.dev
|-.env.prd

1.安装运行​ 导入数据库文件

chancms.sql(data文件夹里面)

2 修改数据库配置文件

env.dev//开发环境
env.prd//生产环境

3 进入server 文件夹 设置npm源安装依赖

npm config set registry https://registry.npmmirror.com //切换新镜像源

安装

npm i
npm run dev

后访问 http://localhost:3000 ,完成网站启动。

后台管理​访问地址

http://localhost:3000/public/admin/index.html

默认账号密码:chancms chancms.top

ChanCMS 当前页面数据:

site-> {"name":"ChanCMS","domain":"www.chancms.top","email":"867528315@qq.com","wx":null,"icp":"皖ICP备2024030927号-1","code":"","title":"ChanCMS内容管理系统","keywords":"chancms_ChanCms_禅cms_网站建设_网站制作_企业建站","description":"chancms是一款基于Express和MySQL研发的高质量实用型CMS管理系统。它具备多种类型网站开发,公司,企业,学校,政府,图片,下载,产品等各类型网站建设。易扩展、基于模块化和插件化开发模式,适用于商用企业级程序开发。","json":""}

nav-> [{"id":9,"pid":0,"name":"首页","pinyin":"home","path":"/home","orderBy":1,"target":"0","status":"0","listView":"chanyue.html","articleView":"chanyue.html","seoTitle":"","seoKeywords":"","seoDescription":"","type":"1","level":1},{"id":1,"pid":0,"name":"案例","pinyin":"case","path":"/case","orderBy":2,"target":"0","status":"0","listView":"list.html","articleView":"article.html","seoTitle":"禅cms案例","seoKeywords":"禅cms,ChanCMS","seoDescription":"禅cms网站案例","type":"0","level":1},{"id":2,"pid":0,"name":"文档","pinyin":"docs","path":"/docs","orderBy":3,"target":"0","status":"0","listView":"list.html","articleView":"article.html","seoTitle":"ChanCMS文档","seoKeywords":"ChanCMS,禅cms,cms,express,nodejs","seoDescription":"ChanCMS使用文档","type":"0","level":1},{"id":3,"pid":0,"name":"模板","pinyin":"muban","path":"/muban","orderBy":4,"target":"0","status":"0","listView":"list.html","articleView":"article.html","seoTitle":"ChanCMS模板","seoKeywords":"禅cms,ChanCMS","seoDescription":"ChanCMS模板市场","type":"0","level":1},{"id":5,"pid":0,"name":"定制","pinyin":"custom","path":"/custom","orderBy":5,"target":"0","status":"0","listView":"list.html","articleView":"article.html","seoTitle":"ChanCMS定制","seoKeywords":"ChanCMS,禅cms,cms,nodecms,express","seoDescription":"ChanCMS基于express进行可定制开发需求","type":"0","level":1},{"id":8,"pid":0,"name":"关于","pinyin":"about","path":"/about","orderBy":6,"target":"0","status":"0","listView":"list.html","articleView":"page.html","seoTitle":"ChanCMS","seoKeywords":"ChanCMS","seoDescription":"ChanCMS","type":"1","level":1}]

category-> [{"id":9,"pid":0,"name":"首页","pinyin":"home","path":"/home","orderBy":1,"target":"0","status":"0","listView":"chanyue.html","articleView":"chanyue.html","seoTitle":"","seoKeywords":"","seoDescription":"","type":"1","level":1},{"id":1,"pid":0,"name":"案例","pinyin":"case","path":"/case","orderBy":2,"target":"0","status":"0","listView":"list.html","articleView":"article.html","seoTitle":"禅cms案例","seoKeywords":"禅cms,ChanCMS","seoDescription":"禅cms网站案例","type":"0","level":1},{"id":2,"pid":0,"name":"文档","pinyin":"docs","path":"/docs","orderBy":3,"target":"0","status":"0","listView":"list.html","articleView":"article.html","seoTitle":"ChanCMS文档","seoKeywords":"ChanCMS,禅cms,cms,express,nodejs","seoDescription":"ChanCMS使用文档","type":"0","level":1},{"id":3,"pid":0,"name":"模板","pinyin":"muban","path":"/muban","orderBy":4,"target":"0","status":"0","listView":"list.html","articleView":"article.html","seoTitle":"ChanCMS模板","seoKeywords":"禅cms,ChanCMS","seoDescription":"ChanCMS模板市场","type":"0","level":1},{"id":5,"pid":0,"name":"定制","pinyin":"custom","path":"/custom","orderBy":5,"target":"0","status":"0","listView":"list.html","articleView":"article.html","seoTitle":"ChanCMS定制","seoKeywords":"ChanCMS,禅cms,cms,nodecms,express","seoDescription":"ChanCMS基于express进行可定制开发需求","type":"0","level":1},{"id":8,"pid":0,"name":"关于","pinyin":"about","path":"/about","orderBy":6,"target":"0","status":"0","listView":"list.html","articleView":"page.html","seoTitle":"ChanCMS","seoKeywords":"ChanCMS","seoDescription":"ChanCMS","type":"1","level":1}]

friendlink-> [{"title":"ChanCMS官网","link":"https://www.chancms.top"}]

static_url-> /public/template/chancms/

frag--->{"PowerBy":"<p style=\"text-align: center;\">Powder By <a href=\"http://www.chancms.top\" target=\"_blank\" rel=\"noopener\">ChanCMS v3.0.14</a></p>","chancms":"<p><span style=\"font-size: 14px;\">ChanCMS是一款基于Node、Express、MySQL、Vue3研发的高质量实用型CMS系统。轻量、灵活、稳定、高性能、易扩展,让开发更简单。</span></p>"}

tag--->{}

position------>[{"id":2,"pid":0,"name":"文档","pinyin":"docs","path":"/docs","orderBy":3,"target":"0","status":"0","listView":"list.html","articleView":"article.html","seoTitle":"ChanCMS文档","seoKeywords":"ChanCMS,禅cms,cms,express,nodejs","seoDescription":"ChanCMS使用文档","type":"0","level":1}]

navSub------>

article------>{"id":81,"cid":2,"subCid":"","title":"ChanCMS系列教程一:安装运行快速入门","shortTitle":"","tagId":"","attr":"","articleView":null,"source":"","author":"","description":"环境配置​前置条件:安装node.js mysql 和 mysql可视化工具。本地开发推荐用phpStudy。","img":"","content":"<p><strong>快速入门​</strong></p>\n<p>环境配置​前置条件:安装node.js mysql 和 mysql可视化工具。本地开发推荐用phpStudy。</p>\n<p><strong>注意:版本有要求</strong></p>\n<pre class=\"language-markup\"><code>nodejs v22.18.0(强烈建议保持一致)\npm2 v6.0.8\nmysql v5.7.26(兼容v5.6)</code></pre>\n<p><strong>项目地址</strong></p>\n<pre class=\"language-markup\"><code>https://gitee.com/chancms/ChanCMS</code></pre>\n<p>文件结构</p>\n<pre class=\"language-javascript\"><code>\n|- app\n |- helper //工具函数\n |- common //业务逻辑(分页, 文件上传等)\n |- extend //第三方包扩展(可选)\n |- middleware //全局中间件\n |- modules //多模块mvc\n |- api \n |- controller \n |- service \n |- guard //权限控制 (可选) \n |- middleware //模块中间件 (可选)\n |- model //数据库模型 (可选)\n |- view //模板文件 (可选)\n |- router.js \n |- base \n |- controller \n |- service \n |- view \n |- router.js\n |- cms \n |- controller \n |- service \n |- view \n |- router.js\n |- web \n |- controller \n |- service \n |- view \n |- router.js\n |- plugin //插件(可选)\n |- plus-module1 \n |- controller \n |- service \n |- view \n |- router.js \n |- module2 \n |- controller \n |- service \n |- view \n |- router.js\n|- config \n|- public\n|- index.js\n|-.env.dev\n|-.env.prd</code></pre>\n<p><strong>1.安装运行​ 导入数据库文件</strong></p>\n<pre class=\"language-markup\"><code>chancms.sql(data文件夹里面)</code></pre>\n<p><strong>2 修改数据库配置文件</strong></p>\n<pre class=\"language-markup\"><code>env.dev//开发环境\nenv.prd//生产环境</code></pre>\n<p><strong>3 进入server 文件夹 设置npm源安装依赖</strong></p>\n<pre class=\"language-markup\"><code>npm config set registry https://registry.npmmirror.com //切换新镜像源</code></pre>\n<p>安装</p>\n<pre class=\"language-markup\"><code>npm i\nnpm run dev</code></pre>\n<p>后访问 http://localhost:3000 ,完成网站启动。</p>\n<p><strong>后台管理​访问地址</strong></p>\n<pre class=\"language-markup\"><code>http://localhost:3000/public/admin/index.html</code></pre>\n<p>默认账号密码:chancms chancms.top</p>","status":0,"pv":7115,"link":"","createdAt":"2024-02-03T14:21:08.000Z","updatedAt":"2025-12-05T09:13:22.000Z","field":{}}

article.tags------>

news------>[{"id":86,"title":"ChanCMS系列视频六:PM2定时清理logs日志(视频)","shortTitle":"","img":"","createdAt":"2024-05-30T08:27:10.000Z","description":"日志可以方便我们查找问题,过多的日志会占用空间,降低服务器运行性能。定期清理日志是必不可少的一步。","pinyin":"docs","name":"文档","path":"/docs"},{"id":85,"title":"ChanCMS系列教程五:Linux服务器部署教程(视频)","shortTitle":"","img":"","createdAt":"2024-05-30T08:18:02.000Z","description":"ChanCMS系列教程五:Linux服务器部署教程(视频操作),讲解nodejs环境部署,mysql安装,pm2运行,域名绑定,反向代理等操作。","pinyin":"docs","name":"文档","path":"/docs"},{"id":84,"title":"ChanCMS系列教程四:后台基本操作(视频)","shortTitle":"","img":"","createdAt":"2024-05-30T08:13:11.000Z","description":"ChanCMS后台基本操作视频,主要讲解一下功能点,通过此视频可以大概了解ChanCMS基本功能。","pinyin":"docs","name":"文档","path":"/docs"},{"id":83,"title":"ChanCMS系列教程三:常用模板标签","shortTitle":"","img":"","createdAt":"2024-05-30T08:06:25.000Z","description":"ChanCMS系列教程三:常用模板标签","pinyin":"docs","name":"文档","path":"/docs"},{"id":82,"title":"ChanCMS系列教程二:模板开发","shortTitle":"","img":"","createdAt":"2024-05-30T07:30:39.000Z","description":"ChanCMS教程之模板开发,模板目录介绍、模板文件介绍、模板开发核心流程、自定义模板数据。","pinyin":"docs","name":"文档","path":"/docs"},{"id":81,"title":"ChanCMS系列教程一:安装运行快速入门","shortTitle":"","img":"","createdAt":"2024-02-03T14:21:08.000Z","description":"环境配置​前置条件:安装node.js mysql 和 mysql可视化工具。本地开发推荐用phpStudy。","pinyin":"docs","name":"文档","path":"/docs"}]

hot------>[{"id":81,"title":"ChanCMS系列教程一:安装运行快速入门","path":"/docs","pv":7116},{"id":82,"title":"ChanCMS系列教程二:模板开发","path":"/docs","pv":4065},{"id":84,"title":"ChanCMS系列教程四:后台基本操作(视频)","path":"/docs","pv":3486},{"id":85,"title":"ChanCMS系列教程五:Linux服务器部署教程(视频)","path":"/docs","pv":3010},{"id":83,"title":"ChanCMS系列教程三:常用模板标签","path":"/docs","pv":2916},{"id":86,"title":"ChanCMS系列视频六:PM2定时清理logs日志(视频)","path":"/docs","pv":2687}]

imgs------>[]

pre------>

next------>{"id":82,"title":"ChanCMS系列教程二:模板开发","name":"文档","path":"/docs"}