千家信息网

如何用Serverless快速搭建个人相册网站

发表于:2026-11-03 作者:千家信息网编辑
千家信息网最后更新 2026年11月03日,本篇文章为大家展示了如何用Serverless快速搭建个人相册网站,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。日常生活中我们经常会拍摄一些视频、照片等,这些
千家信息网最后更新 2026年11月03日如何用Serverless快速搭建个人相册网站

本篇文章为大家展示了如何用Serverless快速搭建个人相册网站,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

日常生活中我们经常会拍摄一些视频、照片等,这些文件会占用比较多的存储空间。小编将介绍一种方法:利用 ThumbsUp 工具,结合 Serverless Framework 的 component 快速搭建个人相册网站,为存储空间减压。

工具介绍:

  • Serverless Framework:Serverless Framework 是业界非常受欢迎的无服务器应用框架,开发者无需关心底层资源即可部署完整可用的 Serverless 应用架构。

  • ThumbsUp 是一款让使用者方便检索及管理图片的看图软件,不但具有可以快速的操作图片切换预览的使用介面,而且对于图片的简单影像处理也有相当直接、便捷的操作方式。

整个网站的搭建部署只需三步:安装与初始化 → 配置 yml 文件 → 部署。

安装与初始化

首先确保系统包含以下环境:

  • Node.js (Node.js 版本需不低于 8.6,建议使用 Node.js 10.0 及以上版本)

  • Exiftool

  • 图形 Magick

如未安装上述应用程序,可以参考安装说明。

1. 安装 Serverless Framework

$ npm install -g serverless

2. 安装 ThumbsUp

$ npm install -g thumbsup

3. 初始化项目

$ md photos$ thumbsup --input .\photos\ --output website

初始化成功后,可以看到项目目录结构:

.├── photos└── website    └── index.html

配置 yml 文件

项目目录下,创建 serverless.yml 文件

cd.> serverless.yml

将以下内容写入上述的 yml 文件里:

# serverless.ymlmyWebsite:  component: "@serverless/tencent-website"  inputs:    code:      src: ./website      index: index.html      error: index.html    region: ap-guangzhou    bucketName: my-bucket-1111

配置完成后,文件目录如下:

.├── photos├── website|   └── index.html└── serverless.yml

部署

通过 sls 命令进行部署,并可以添加 --debug 参数查看部署过程中的信息

如您的账号未登陆或注册腾讯云,您可以直接通过微信扫描命令行中的二维码进行授权登陆和注册。

sls --debug  DEBUG ─ Resolving the template's static variables.  DEBUG ─ Collecting components from the template.  DEBUG ─ Downloading any NPM components found in the template.  DEBUG ─ Analyzing the template's components dependencies.  DEBUG ─ Creating the template's components graph.  DEBUG ─ Syncing template state.  DEBUG ─ Executing the template's components graph.  DEBUG ─ Starting Website Component.  DEBUG ─ Preparing website Tencent COS bucket my-bucket-thumbsup-1256386184.  DEBUG ─ Deploying "my-bucket-thumbsup-1256386184" bucket in the "ap-guangzhou" region.  DEBUG ─ "my-bucket-thumbsup-1256386184" bucket was successfully deployed to the "ap-guangzhou" region.  DEBUG ─ Setting ACL for "my-bucket-thumbsup-1256386184" bucket in the "ap-guangzhou" region.  DEBUG ─ Ensuring no CORS are set for "my-bucket-thumbsup-1256386184" bucket in the "ap-guangzhou" region.  DEBUG ─ Ensuring no Tags are set for "my-bucket-thumbsup-1256386184" bucket in the "ap-guangzhou" region.  DEBUG ─ Configuring bucket my-bucket-thumbsup-1256386184 for website hosting.  DEBUG ─ Uploading website files from D:\tencent-serverless\thumbsup\website to bucket my-bucket-thumbsup-1256386184.  DEBUG ─ Starting upload to bucket my-bucket-thumbsup-1256386184 in region ap-guangzhou  DEBUG ─ Uploading directory D:\tencent-serverless\thumbsup\website to bucket my-bucket-thumbsup-1256386184  DEBUG ─ Website deployed successfully to URL: http://my-bucket-thumbsup-1256386184.cos-website.ap-guangzhou.myqcloud.com.  myWebsite:    url: http://my-bucket-thumbsup-1256386184.cos-website.ap-guangzhou.myqcloud.com    env:  13s » myWebsite » done

访问命令行输出的 website url,即可查看即可查看使用 Serverless Framework 部署的照片墙网站。

注:如果希望更新网站中的照片或者视频等文件,可以在 photos 文件夹更新照片后,在本地重新运行 thumbsup --input .\photos\ --output website 更新本地页面,再运行 sls 即可更新网站。

上述内容就是如何用Serverless快速搭建个人相册网站,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注行业资讯频道。

文件 网站 照片 更新 个人 个人相册 相册 内容 命令 图片 目录 项目 应用 配置 工具 技能 版本 知识 空间 视频 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 互联网科技企业 湖北九亚互联网络科技有限公司 互联网电商科技 没上市的科技互联网公司 上海挚品互联网科技 互联网高科技企业 长亮科技 互联网金融 互联网科技大会案例 互联网科技寓意 全球顶尖互联网科技公司 燊美集互联网科技有限公司 陕西云淼互联网科技公司 广州有谷有贝互联网科技有限公司 南京一网一红互联网科技有限公司 西安有哪些互联网高科技企业 吉林省码上互联网科技电话 互联网科技手抄报图片 互联网科技收购价值 山东蛋芒互联网科技有限公司 中国主要互联网科技公司 互联网科技与金融科技 深圳卡尔迅互联网科技有限公司怎么样 互联网科技股午盘股票涨跌 互联网与医疗科技 本届互联网博览会上的黑科技 中科明德北京互联网科技 江苏互联网智能科技软件 互联网科技年终奖 互联网科技融合创新 湖北辰鑫科技互联网
0