[{"data":1,"prerenderedAt":155},["ShallowReactive",2],{"$f35oJMNvYxaous-dq-T_inxi1gZgqNwvzu7XHb-bcbEU":3,"$fFE5y6Jqx3o82XQSuZA-YBYyid5ujYfvAAiLvtP8w4c4":87},{"flag":4,"code":5,"message":6,"data":7},true,20000,"操作成功",{"articleCount":8,"categoryCount":9,"tagCount":10,"viewsCount":11,"websiteConfig":12,"pageList":32},23,14,36,"2265",{"websiteAvatar":13,"websiteName":14,"websiteAuthor":15,"websiteIntro":16,"websiteNotice":17,"websiteCreateTime":18,"websiteRecordNo":19,"socialLoginList":20,"socialUrlList":22,"qq":24,"github":25,"gitee":17,"touristAvatar":26,"userAvatar":26,"isCommentReview":27,"isMessageReview":27,"isEmailNotice":28,"isReward":28,"weiXinQRCode":29,"alipayQRCode":30,"isChatRoom":27,"websocketUrl":31,"isMusicPlayer":27},"http://static.gaoyuan.site/config/e46ea2645f3dd9675fd5189b0a45eba7.png","AseaBlog","Asea","远离世界这个巨大的求偶派对","","2021-03-17","豫ICP备2022022909号",[21],"qq",[21,23],"github","569389750","https://github.com/AAAAsea","https://static.gaoyuan.site/config/8c4f6216475f61d53530b5176f81aaac.svg",0,1,"http://static.gaoyuan.site/config/1823a52c81a8505abd7294c938cdf883.png","http://static.gaoyuan.site/config/e9abb2f6dfffa28a182b2075d0f39f10.png","wss://ws.gaoyuan.site",[33,37,42,47,52,57,62,67,72,77,82],{"pageCover":34,"id":28,"pageName":35,"pageLabel":36},"https://static.gaoyuan.site/config/a85b70bea8c133b472c1685a8bdf25ab.jpg","首页","home",{"pageCover":38,"id":39,"pageName":40,"pageLabel":41},"https://static.gaoyuan.site/config/e260a3325afb7db4e1f952daacbae20b.jpg",2,"归档","archive",{"pageCover":43,"id":44,"pageName":45,"pageLabel":46},"https://static.gaoyuan.site/config/e569b56363399be08d1af02e42f6e093.jpg",3,"分类","category",{"pageCover":48,"id":49,"pageName":50,"pageLabel":51},"https://static.gaoyuan.site/config/a2fa96c7647cc9bf7f7a664ce2e2e9c7.jpg",4,"标签","tag",{"pageCover":53,"id":54,"pageName":55,"pageLabel":56},"https://static.gaoyuan.site/config/95b34f6757f1d7a0200de560914e91c5.jpg",5,"相册","album",{"pageCover":58,"id":59,"pageName":60,"pageLabel":61},"https://static.gaoyuan.site/config/992efd73eb0fc15fe0482f814ed30d44.jpg",6,"友链","link",{"pageCover":63,"id":64,"pageName":65,"pageLabel":66},"https://static.gaoyuan.site/config/f18979a0cc4dc1003d57a3fa448f01fb.jpg",7,"关于","about",{"pageCover":68,"id":69,"pageName":70,"pageLabel":71},"https://static.gaoyuan.site/config/28e56705f217056a9014da8fb38807b2.png",8,"留言","message",{"pageCover":73,"id":74,"pageName":75,"pageLabel":76},"https://static.gaoyuan.site/config/8fa30e6fc9f8377d80972c481000d562.jpg",9,"个人中心","user",{"pageCover":78,"id":79,"pageName":80,"pageLabel":81},"https://static.gaoyuan.site/config/f9299debbc0ea7c27021c0f7fec26d57.jpg",10,"文章列表","articleList",{"pageCover":83,"id":84,"pageName":85,"pageLabel":86},"https://static.gaoyuan.site/config/7a15cde107e6da90421702e183068048.jpg",904,"说说","talk",{"flag":4,"code":5,"message":6,"data":88},{"id":89,"articleCover":90,"articleTitle":91,"articleContent":92,"likeCount":93,"viewsCount":94,"type":28,"originalUrl":17,"createTime":95,"updateTime":96,"categoryId":97,"categoryName":98,"tagDTOList":99,"lastArticle":109,"nextArticle":113,"recommendArticleList":117,"newestArticleList":129},77,"https://static.gaoyuan.site/articles/8ebe654f9670c0f81b87e111cc121130.png","前后端（node）项目部署流程","> 已经部署过很多个项目了，但每次都有些问题，所以打算做个记录\n## 前端\n### 上传\n#### 脚本\n可以通过FileZillia等ssh工具上传，也可以通过脚本（后续更新常用这个）上传\n```bash\nscp -r ./dist/* root@你的IP:/usr/local/vue/某个文件夹\n```\n#### 自动创建文件夹\n如果当前文件夹不存在的话会报错，你可以在FileZillia手动创建，或者使用下面的命令：\n```bash\n# 首先检查文件夹是否存在\nssh root@你的IP \"[ -d /usr/local/vue/某个文件夹 ] && echo ok || mkdir -p /usr/local/vue/某个文件夹\"\nscp -r ./dist/* root@你的IP:/usr/local/vue/某个文件夹\n```\n#### 免密\n> scp每次都需要输入密码，可以设置免密\n1. 在A中执行命令：\n\n\t```bash\n\tssh-keygen -t rsa -P \"\"\n\t```\n这会在 ~/.ssh 目录下生成两个文件：id_rsa 和 id_rsa.pub\n\n2. 在A中执行命令，拷贝A的id_rsa.pub到B（具体路径根据windos和linux做调整）：\n\n   ```bash\n   scp /.ssh/id_rsa.pub root@你的IP:/root/.ssh\n   ```\n\n3. 在B中执行命令，把id_rsa.pub输入到B的authorized_keys文件中：\n\n   ```bash\n   cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys\n   ```\n\n   \n\n### Nginx\n\n#### 配置\n\n这里贴一下常用的配置，可以自己根据需要做调整\n\n```yaml\nevents {\n    worker_connections  1024;\n}\n\nhttp {\n    include       mime.types;\n    default_type  application/octet-stream;\n    sendfile        on;\n    keepalive_timeout  65;\n\n    client_max_body_size     50m;\n    client_body_buffer_size  10m; \t  \n    client_header_timeout    1m;\n    client_body_timeout      1m;\n\n    gzip on;\n    gzip_min_length  1k;\n    gzip_buffers     4 16k;\n    gzip_comp_level  4;\n    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;\n    gzip_vary on;\n    \n    # http\n    server {\n        listen       80;\n        server_name  域名;\n\n        location / {\n            root   /usr/local/vue/test;\n            index  index.html index.htm;\n            try_files $uri $uri/ /index.html;\n        }\n\n        location ^~ /api/ {\n            proxy_pass http://IP:端口/;\n            proxy_set_header   Host             $host;\n            proxy_set_header   X-Real-IP        $remote_addr;\n            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;\n            rewrite  ^/api/(.*)$ /$1 break;\n        }\n    }\n    \n    # https\n    server {\n        listen  443 ssl;\n        server_name  域名;\n\n        # ssl on;\n        ssl_certificate    /usr/local/nginx/cert/test.com_bundle.pem; # 需要配置证书\n        ssl_certificate_key  /usr/local/nginx/cert/test.com.key;\n        ssl_session_timeout 5m;\n        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;\n        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\n        ssl_prefer_server_ciphers on;\n\n        location / {\n            root   /usr/local/vue/test;\n            index  index.html index.htm;\n            try_files $uri $uri/ /index.html;\n        }\n\n        location ^~ /list {\n            proxy_pass http://IP:端口/;\n            proxy_set_header   Host             $host;\n            proxy_set_header   X-Real-IP        $remote_addr;\n            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;\n            rewrite  ^/list/(.*)$ /$1 break;\n        }\n    }\n    \n    # http + socket.io\n    server {\n        listen       80;\n        server_name  域名;\n\n        location / {\n                root   /usr/local/vue/test;\n                index  index.html index.htm;\n                try_files $uri $uri/ /index.html;\n            }\n\n            location ^~ /socket.io/ {\n                proxy_pass http://1.15.113.60:30010/;\n                proxy_http_version 1.1;\n                proxy_set_header Upgrade $http_upgrade;\n                proxy_set_header Connection \"Upgrade\";\n            }\n            location ^~ /upload/ {\n                proxy_pass http://1.15.113.60:30010/;\n            }\n    }\n    \n    # https + socket.io\n    server {\n        listen  443 ssl;\n        server_name  域名;\n\n        # ssl on;\n        ssl_certificate    /usr/local/nginx/cert/test.com_bundle.pem;\n        ssl_certificate_key  /usr/local/nginx/cert/test.com.key;\n        ssl_session_timeout 5m;\n        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;\n        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\n        ssl_prefer_server_ciphers on;\n\n        location / {\n            root   /usr/local/vue/test;\n            index  index.html index.htm;\n            try_files $uri $uri/ /index.html;\n        }\n\n        location ^~ /socket.io/ {\n            proxy_pass http://124.221.154.52:5000; # 这里不能加/\n            proxy_set_header Upgrade $http_upgrade;\n            proxy_set_header Connection \"upgrade\";\n            proxy_http_version 1.1;\n            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n            proxy_set_header Host $host;\n        }\n    }\n}\n```\n\n#### https证书\n\n去腾讯云申请免费证书\n\n#### 启动\n\n启动nginx就不说了，因为我直接\n\n```bash\ndocker restart nginx\n```\n\n## 后端\n\n#### Dockerfile\n\n类似，先上传，然后编写dockerfile\n\n```dockerfile\nFROM node # # FROM 表示设置要制作的镜像基于哪个镜像，FROM指令必须是整个Dockerfile的第一个指令，如果指定的镜像不存在默认会自动从Docker Hub上下载\nWORKDIR /home/backend/meeting # RUN的工作目录\nCOPY . /home/backend/meeting # 复制到容器内的目录\nRUN npm config set registry https://registry.npm.taobao.org # 换源\nRUN npm i  # 安装包\nEXPOSE 5000 # 端口号\nCMD [\"node\",\"server.js\"] # 容器启动时执行的命令\n```\n\n将dockerfile放在文件夹里，执行\n\n```bash\ndocker build -t 起个名字 .\n```\n\n然后等待\n\n#### 启动镜像\n\n```bash\ndocker images # 可以看到自己构建的镜像\ndocker run -d -p 5000:5000 镜像名字\n\n# 常用命令\ndocker ps # 查看容器\ndocker ps -a # 查看所有容器（包括killed的）\ndocker logs --tail 10 容器id\n```\n#### 更新\n更新有两条路：\n1. 删除原有镜像和容器，上传新的文件，重新构建镜像并启动\n2. 直接将文件上传到容器内，然后重启容器\n下面以第二种为例\n```bash\n@REM 上传-拷贝-重启（必须在本目录下执行，因为有相对路径）\nscp ./server.js root@你的IP:/usr/local/backend/meeting/\nssh root@IP \"docker cp  /usr/local/backend/meeting/server.js 容器id:/home/backend/meeting; docker restart 容器id;\"\necho 后端更新成功\n```\n这里只拷贝了server.js，而且不涉及其它依赖下载，如果还要下载其它依赖更推荐第一种\n\n#### 其它配置\n\n#### DNS解析\n\n自己到域名服务器解析一下\n\n#### 端口防火墙\n\n根据自己的项目需求打开防火墙",null,28,"2022-11-18T13:59:42","2023-09-28T11:30:18",189,"项目部署",[100,103,106],{"id":101,"tagName":102},44,"docker",{"id":104,"tagName":105},45,"部署",{"id":107,"tagName":108},46,"node",{"id":110,"articleCover":111,"articleTitle":112},74,"https://static.gaoyuan.site/articles/674685ff99028922bf61ee86de2321f1.jpg","Instant-ngp复现和自拍数据集的运行",{"id":114,"articleCover":115,"articleTitle":116},78,"https://static.gaoyuan.site/articles/6d71d8aed9146caeb613ee7165344996.jpg","BUGS记录",[118,123,125],{"id":119,"articleCover":120,"articleTitle":121,"createTime":122},79,"https://static.gaoyuan.site/articles/feb3e5f57f114dea2a3cb0a54262bb03.png","服务器迁移记录","2023-03-01T01:45:59",{"id":114,"articleCover":115,"articleTitle":116,"createTime":124},"2023-01-30T10:44:03",{"id":126,"articleCover":127,"articleTitle":91,"createTime":128},76,"https://static.gaoyuan.site/articles/385107cafc69562e722ba61cbeafece0.png","2022-11-18T13:57:50",[130,135,140,145,150],{"id":131,"articleCover":132,"articleTitle":133,"createTime":134},97,"https://static.gaoyuan.site/articles/4c75f2fc58fc62705384d2ea5c7541e2.jpg","青甘遗梦","2025-05-12T09:39:04",{"id":136,"articleCover":137,"articleTitle":138,"createTime":139},96,"https://static.gaoyuan.site/articles/71622894786ad69c24e6ea642d05a275.jpg","我的阿勒泰","2025-01-11T00:05:58",{"id":141,"articleCover":142,"articleTitle":143,"createTime":144},95,"https://static.gaoyuan.site/articles/8311a8f3a94aab354101e80f4132e12e.png","记忆贩卖店","2024-10-20T17:59:23",{"id":146,"articleCover":147,"articleTitle":148,"createTime":149},94,"https://static.gaoyuan.site/articles/de098d9194c59e1cecf75c84e0585648.jpg","我的阿尔山","2024-10-05T14:04:31",{"id":151,"articleCover":152,"articleTitle":153,"createTime":154},93,"https://static.gaoyuan.site/articles/dd97d39aaef628a7c74d96879c88ebf6.jpg","我的拉班·扫马","2024-07-04T23:36:50",1782639793711]