simpleCMS is an open source CMS system, mainly used for individuals/teams to quickly develop blogs or knowledge sharing platforms, similar to hexo and worldpress, but they often require complex setup processes. We have minimized the complexity and have detailed deployment tutorials. , you only need a server to easily have a blog platform of your own.
simpleCMS is an open source cms system, mainly for individuals/teams to quickly develop blogs or knowledge sharing platforms, similar to hexo, worldpress, but they often require complex build processes, we minimize complexity, and have detailed deployment tutorials, you only need a server, you can easily have a blog platform that belongs to you.
server
and manage
directories respectively and execute: # cd manage
yarn
# cd server
yarn
Management side starts:
# cd manage
yarn start
Server startup:
# cd server
yarn start
In order to allow the management side to call the server interface across domains, a cross-domain whitelist needs to be configured in server/src/index.js:
// 设置跨域
app . use (
cors ( {
origin : function ( ctx ) {
const whiteList = [
"http://192.168.1.10:8000" , // 你的管理后台ip地址,为了支持跨域调用
] ; //可跨域白名单
if (
whiteList . includes ( ctx . request . header . origin ) &&
ctx . url . indexOf ( config . API_VERSION_PATH ) > - 1
) {
return ctx . request . header . origin ; //注意,这里域名末尾不能带/,否则不成功,所以在之前我把/通过substr干掉了,允许来自指定域名请求, 如果设置为*,前端将获取不到错误的响应头
}
return "" ;
} ,
exposeHeaders : [ "WWW-Authenticate" , "Server-Authorization" , "x-show-msg" ] ,
maxAge : 5 , // 该字段可选,用来指定本次预检请求的有效期,单位为秒
credentials : true ,
allowMethods : [ "GET" , "POST" , "PUT" , "DELETE" , "OPTIONS" ] ,
allowHeaders : [
"Content-Type" ,
"Authorization" ,
"Accept" ,
"X-Requested-With" ,
] ,
} )
) ;
At the same time, configure the server IP in manage/src/utils/index.ts.
export const SERVER_URL = 'http://192.168.1.10:3000'
Execute in manage project:
yarn build
After that, the project will be automatically packaged into the server/static directory. At this time, execute in the server project:
yarn build
The server code will be packaged and run locally at this time:
node dist/index.js
The CMS project can be started.
For server-side deployment, pm2 can be used as the manager of node applications. For specific usage, please refer to the pm2 official website.