{"id":17140060,"url":"https://github.com/mrxujiang/xpcms","last_synced_at":"2025-10-12T14:45:16.469Z","repository":{"id":35840452,"uuid":"210504600","full_name":"MrXujiang/XPCMS","owner":"MrXujiang","description":"基于node的cms系统, 后端采用node+koa+redis，并通过本人封装的redis库实现数据操作，前端采用vue+ts+vuex开发，后台管理系统采用react全家桶开发","archived":false,"fork":false,"pushed_at":"2023-01-04T11:51:20.000Z","size":12888,"stargazers_count":217,"open_issues_count":55,"forks_count":71,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-09T22:14:09.762Z","etag":null,"topics":["node","node-cms","node-js","react","react-router","redis","vue","vuex"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrXujiang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-24T03:35:03.000Z","updated_at":"2024-11-04T02:43:38.000Z","dependencies_parsed_at":"2023-01-16T07:30:40.511Z","dependency_job_id":null,"html_url":"https://github.com/MrXujiang/XPCMS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrXujiang%2FXPCMS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrXujiang%2FXPCMS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrXujiang%2FXPCMS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrXujiang%2FXPCMS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrXujiang","download_url":"https://codeload.github.com/MrXujiang/XPCMS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119290,"owners_count":21050755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node","node-cms","node-js","react","react-router","redis","vue","vuex"],"created_at":"2024-10-14T20:13:45.442Z","updated_at":"2025-10-12T14:45:11.430Z","avatar_url":"https://github.com/MrXujiang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\" style=\"font-size:36px;font-weight:bold\"\u003e\n  XPCMS\n\u003c/h1\u003e\n\n# XPCMS\n\nXPCMS是一个开源的CMS系统，服务端采用node+koa+redis+json-schema实现.view层管理端使用vue生态，客户端使用react生态。架构如下：\n\n\u003cimg src=\"./read.png\" /\u003e\n\n\n# 安装\n\nserver,client_page,media这三端都可以采用如下安装方式安装依赖：\n```js\nnpm install\n// or yarn\n```\n\n# 开发环境启动\n\n#### 1.安装redis并启动redis服务\n具体细节请参考我的文章[基于nodeJS从0到1实现一个CMS全栈项目的服务端启动细节](https://juejin.im/post/5d8f5107f265da5bb74640eb)\n#### 2.启动server后台服务\n``` js\nnpm start\n```\n#### 3.启动管理后台页面\n``` js\nnpm run serve\n// or yarn serve\n```\n#### 4.启动前台门户页面\n``` js\nnpm start\n```\n\n# 生产环境部署方案\n#### 1.打包服务端代码\n``` js\n// server\nnpm run build\n```\n\n#### 2.打包管理端web代码\n``` js\n// client_page\nnpm run build\n```\n\n#### 3.打包门户网站代码\n``` js\n// media\nnpm run build\n```\n\n#### 4.服务器部署\n\u003e 我们可以使用代码管理工具如gitlab或者公司私有仓库管理代码，然后提交到服务器上，如果对git/svn部署不太了解，我们可以将server目录整体发送到web服务器中，安装相关依赖并运行，但这种方式不推荐。\n\n##### 1.pm2做服务端持久化\n假设我们服务器上安装好了redis并启动了服务，我们可以使用pm2去做node服务崩溃自动重启：\n``` bash\nnpm install -g pm2\n# 启动node程序\npm2 dist\n```\n更多细节我会持续完善。\n\n# nginx做静态代理服务器\n这里需要先在web服务器中安装nginx，安装过程也很简单，可以去官网查看。\n这里给出如何用nginx代理多网站的方案：\n``` bash\n#user  nobody;\nworker_processes  1;\n\n#error_log  logs/error.log;\n#error_log  logs/error.log  notice;\n#error_log  logs/error.log  info;\n\n#pid        logs/nginx.pid;\n\n\nevents {\n    worker_connections  1024;\n}\n\n\nhttp {\n    include       mime.types;\n    default_type  application/octet-stream;\n\n    log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '\n                      '$status $body_bytes_sent \"$http_referer\" '\n                      '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n\n    access_log  logs/access.log  main;\n\n    sendfile        on;\n    #tcp_nopush     on;\n\n    #keepalive_timeout  0;\n    keepalive_timeout  65;\n\n    #gzip  on;\n\n    server {\n        listen       80;\n        server_name  localhost;\n\n        #charset koi8-r;\n\n        #access_log  logs/host.access.log  main;\n\n        location / {\n            root   /www/XPXMS/server/static/cmsClient; \n            index  index.html index.htm;\n            # 在生产环境vue使用history router的配置\n\t          try_files $uri $uri/ /index.html;\n        }\n\n        error_page  404        /www/XPXMS/server/static/adminManage/index.html;\n\n        # redirect server error pages to the static page /50x.html\n        #\n        error_page   500 502 503 504  /50x.html;\n        location /50x.html {\n            root   html;\n        }\n\n        # proxy the PHP scripts to Apache listening on 127.0.0.1:80\n        # api的请求代理到node服务器\n        location /api {\n            proxy_pass http://127.0.0.1:3000;\n        }\n\n        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\n        #\n        location ~ \\.php$ {\n            root           html;\n            fastcgi_pass   127.0.0.1:9000;\n            fastcgi_index  index.php;\n            fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;\n            include        fastcgi_params;\n        }\n\n        # deny access to .htaccess files, if Apache's document root\n        # concurs with nginx's one\n        #\n        #location ~ /\\.ht {\n        #    deny  all;\n        #}\n    }\n\n\n    # another virtual host using mix of IP-, name-, and port-based configuration\n    #\n    server {\n        listen       8000;\n       # listen       somename:8080;\n        server_name  localhost;\n\n        location / {\n            root  /www/XPXMS/server/static/adminManage;\n            index  index.html index.htm;\n            # 在生产环境react使用history router的配置\n\t          try_files $uri $uri/ /index.html;\n        }\n\n        location /api {\n            proxy_pass http://127.0.0.1:3000;\n        }\n\n        location /uploads {\n            root /www/XPXMS/server/public/;\n        }\n    }\n\n\n    # HTTPS server\n    #\n    #server {\n    #    listen       443 ssl;\n    #    server_name  localhost;\n\n    #    ssl_certificate      cert.pem;\n    #    ssl_certificate_key  cert.key;\n\n    #    ssl_session_cache    shared:SSL:1m;\n    #    ssl_session_timeout  5m;\n\n    #    ssl_ciphers  HIGH:!aNULL:!MD5;\n    #    ssl_prefer_server_ciphers  on;\n\n    #    location / {\n    #        root   html;\n    #        index  index.html index.htm;\n    #    }\n    #}\n\n}\n\n```\n\n# License\n\nMIT [http://rem.mit-license.org](http://rem.mit-license.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrxujiang%2Fxpcms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrxujiang%2Fxpcms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrxujiang%2Fxpcms/lists"}