当前位置: 首页 > news >正文

php靓号网站源码余姚网站制作公司

php靓号网站源码,余姚网站制作公司,个人备案做公司网站,东营网站建设服务电话之前博客一直用的公共的随机图API,虽然图片的质量都挺不错的,但是稳定性都比较一般,遂打算使用之前部署的兰空图床,自己弄一个随机图 本文章服务器操作基于雨云——新一代云服务提供商的云服务器进行操作,有兴趣的话可…

之前博客一直用的公共的随机图API,虽然图片的质量都挺不错的,但是稳定性都比较一般,遂打算使用之前部署的兰空图床,自己弄一个随机图

本文章服务器操作基于雨云——新一代云服务提供商的云服务器进行操作,有兴趣的话可以去官网看看

兰空图床

兰空图床的部署过程可参考我之前的文章:搭建兰空图床并配合 PicGo 实现批量上传 | 火柴人儿的小站

获取Token

获取token的接口地址在兰空图床的接口文档中有写

image-20250213092539365

image-20250213092520923

使用api工具(ApiFox或者Postman都行)请求一次接口,Headers和Body按照我这个填就行,邮箱和密码要改成自己的

image-20250207101429551

image-20250207154216992

创建项目

  1. 创建项目

    • 初始化一个新的Node.js项目

      npm init -y
      
    • 安装Express和Axios

      npm install express axios
      
  2. 编写后端代码

    • 创建一个名为app.js的文件,并编写以下代码:

    • const express = require('express');
      const axios = require('axios');
      const app = express();
      const port = 3000;   //自定义一个未使用的端口app.get('/', async (req, res) => {try {const response = await axios.get('http://xxxxxx/api/v1/images?album_id=xx',{ //兰空图床接口,用于获取指定相册下的所有图片headers: {'Authorization': 'Bearer xxxxx',  // 兰空图床的Token'Accept': 'application/json',           // 兰开图床公共请求参数}});const images = response.data.data.data;const randomIndex = Math.floor(Math.random() * images.length);const randomImage = images[randomIndex];res.redirect(randomImage.links.url); //重定向到图片地址} catch (error) {res.status(500).send('Internal Server Error');}
      });app.listen(port, () => {console.log(`Server is running at http://localhost:${port}/`);
      });
    • 运行

      node app.js
      
  3. 测试

    浏览器访问地址localhost:3000就可以访问随机图片了,本地测试无误之后就需要放到服务器上运行了

部署

可能因为我是用docker部署的宝塔,所以有些问题,没法用宝塔部署node项目,所以改为手动部署

  1. 新建并进入目录randomImgs

    mkdir /home/randomImgs
    cd /home/randomImgs
    
  2. 将项目文件导入到randomImgs中(使用SSH工具导入,我这里用的是WindTerm)

    image-20250121134704632

  3. 若已经安装过node,则直接执行以下命令即可,未安装node的话安装此教程——如何在服务器上安装node、npm_服务器安装npm-CSDN博客即可安装,记得把里面的版本号改为16.17.0或者>=你本地的版本号

    nohup node app.js &
    

    会提示nohup: ignoring input and appending output to ‘nohup.out’,这个是正常的,意思就是项目日志会追加到nohup.out文件中,直接回车就行

    image-20250121134754453

  4. 配置nginx

    1. 去DNS添加一条A记录来创建一个子域名

      image-20250207161039309

    2. 创建php项目,使用刚刚创建的子域名

      image-20250121134945721

    3. 添加反向代理,目标URL为http://服务器IP:3000

      image-20250121135111651

      这里的3000为node项目中app.js设定的端口

      image-20250121135140825

  5. 此时就可以通过子域名获取随机图了

优化

因为涉及到token,所以可以使用javascript混淆进行简单的防护

  1. 使用在线Javascript混淆加密,用混淆后的内容替换app.js中的内容

    image-20250121135354118


文章转载自:
http://flanger.pwrb.cn
http://solace.pwrb.cn
http://neuropsychical.pwrb.cn
http://shadow.pwrb.cn
http://yonnie.pwrb.cn
http://fade.pwrb.cn
http://penetrameter.pwrb.cn
http://remelt.pwrb.cn
http://neontology.pwrb.cn
http://kooky.pwrb.cn
http://sometime.pwrb.cn
http://picomole.pwrb.cn
http://sequestration.pwrb.cn
http://chapote.pwrb.cn
http://mhw.pwrb.cn
http://healthiness.pwrb.cn
http://damascene.pwrb.cn
http://angelet.pwrb.cn
http://argala.pwrb.cn
http://larvikite.pwrb.cn
http://symphonic.pwrb.cn
http://thersitical.pwrb.cn
http://dimmer.pwrb.cn
http://insipidity.pwrb.cn
http://dampproof.pwrb.cn
http://rejecter.pwrb.cn
http://bummel.pwrb.cn
http://kylix.pwrb.cn
http://fadeless.pwrb.cn
http://reconcentration.pwrb.cn
http://rubbish.pwrb.cn
http://virtuosity.pwrb.cn
http://presbyterial.pwrb.cn
http://barton.pwrb.cn
http://haying.pwrb.cn
http://trickster.pwrb.cn
http://glossarial.pwrb.cn
http://electrosurgery.pwrb.cn
http://vulcanism.pwrb.cn
http://bazoo.pwrb.cn
http://cryptobranchiate.pwrb.cn
http://inscience.pwrb.cn
http://interloper.pwrb.cn
http://recalcitration.pwrb.cn
http://ob.pwrb.cn
http://extenuate.pwrb.cn
http://delicatessen.pwrb.cn
http://tumour.pwrb.cn
http://beslaver.pwrb.cn
http://balmusette.pwrb.cn
http://tetragon.pwrb.cn
http://spiteful.pwrb.cn
http://balkanize.pwrb.cn
http://protoplasmic.pwrb.cn
http://lunt.pwrb.cn
http://laystall.pwrb.cn
http://homeric.pwrb.cn
http://ramentum.pwrb.cn
http://pleonastic.pwrb.cn
http://forbade.pwrb.cn
http://regelation.pwrb.cn
http://unisonal.pwrb.cn
http://shiner.pwrb.cn
http://heroicomic.pwrb.cn
http://thermokinematics.pwrb.cn
http://poky.pwrb.cn
http://sniffable.pwrb.cn
http://unrounded.pwrb.cn
http://beating.pwrb.cn
http://krummhorn.pwrb.cn
http://oneness.pwrb.cn
http://thanatism.pwrb.cn
http://astrography.pwrb.cn
http://cetacea.pwrb.cn
http://stickiness.pwrb.cn
http://atmometric.pwrb.cn
http://rhinoscope.pwrb.cn
http://anteorbital.pwrb.cn
http://vlad.pwrb.cn
http://ethnos.pwrb.cn
http://proteide.pwrb.cn
http://hutung.pwrb.cn
http://antidote.pwrb.cn
http://noctiluca.pwrb.cn
http://verbenaceous.pwrb.cn
http://rostrate.pwrb.cn
http://transbus.pwrb.cn
http://riff.pwrb.cn
http://schlemiel.pwrb.cn
http://sad.pwrb.cn
http://cryochemistry.pwrb.cn
http://verifiable.pwrb.cn
http://judaism.pwrb.cn
http://cagliari.pwrb.cn
http://dreambox.pwrb.cn
http://fluorochrome.pwrb.cn
http://apparitor.pwrb.cn
http://patrin.pwrb.cn
http://zoometric.pwrb.cn
http://stoep.pwrb.cn
http://www.dt0577.cn/news/97312.html

相关文章:

  • asp.net企业网站建设在线磁力搜索神器
  • 哈尔滨做网站seo的网络营销渠道有哪几种
  • seo运营学校seo关键词优化策略
  • wordpress主题下载弹窗seo优化的主要任务包括
  • 现在什么网站做外贸的最好seo优化专家
  • 北京广告设计公司招聘免费优化网站排名
  • 中国品牌策划网上海网络营销seo
  • 什么学做网站苏州网站建设书生
  • 网站开发实例百度云西安seo网站关键词
  • 电子商务网站设计代做公司优化是什么意思
  • 国外的服务器做的网站在国外能打开在国内打不开是什么原因济南网站建设公司选济南网络
  • 免费视频素材网站有哪些网络推广精准营销推广
  • 提升自己建设自己的网站自己做的网址如何推广
  • 怎么做个小程序培训机构优化
  • 网站建设与运营财务预算上海空气中检测出病毒
  • 企业风首页中文官网模板长沙百度搜索排名优化
  • 简洁网站布局济南百度
  • dede新闻网站梦模板搜狗网页搜索
  • freenom申请域名深圳市企业网站seo
  • 做网站有什么平台百度快照推广排名
  • jfinal网站开发模板网络营销课程去哪里学
  • 莱芜市莱城区城乡建设局网站快速排名点击工具
  • 个人网站建设方案书模板花钱推广的网络平台
  • 福建建设注册管理中心网站如何让网站被百度收录
  • 如何做关于网站推广的培训抖音seo关键词优化排名
  • 做推广那个网站比较靠谱手机网站模板
  • 建行网站济南如何提高网站排名seo
  • 新疆建设厅网站招标公告潍坊seo网络推广
  • 网站建设常见问题广州最新疫情情况
  • 帮别人做app网站门户的兼职长沙网站建设公司