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

有没有专业做二手老车的网站正规推广赚佣金的平台

有没有专业做二手老车的网站,正规推广赚佣金的平台,婚庆网站模板下载,咸阳做网站托管说明 日期:2025年5月30日 与以纯文本形式发送和接收消息的标准 HTTP 不同,HTTPS 使用SSL/TLS等协议对服务器进行身份验证、加密通信内容和检测篡改。 这样可以防止欺骗、中间人攻击和窃听等攻击。 证书很重要,如果用户主动信任了伪造证书&…

说明

日期:2025年5月30日

与以纯文本形式发送和接收消息的标准 HTTP 不同,HTTPS 使用SSL/TLS等协议对服务器进行身份验证、加密通信内容和检测篡改。 这样可以防止欺骗、中间人攻击和窃听等攻击。

证书很重要,如果用户主动信任了伪造证书,那https的优势就荡然无存了,所以不要自己添加证书。

示例

日期:2025年5月30日。
操作系统:Alibaba Cloud Linux 3.2104 LTS 64位。
应用:

  • node.js v22.15.1
  • npm 11.4.1
  • Certbot

安装SSL证书

公开的SSL证书必须使用固定域名或固定公网ip。
示例中使用域名fxxkrock.top

修改时区,有的linux失去不是中国,SSL证书含有证书起止时间,所以申请SLL证书后修改时间可能导致证书失效。

sudo timedatectl set-timezone Asia/Shanghai

添加 EPEL 仓库(Certbot 依赖)

sudo yum install -y epel-release

报错

[ecs-user@iZbp18zmckjuyndr4e25koZ server_crystalsearch]$ sudo yum install -y epel-release
Last metadata expiration check: 15:18:43 ago on Thu 29 May 2025 08:17:50 PM CST.
Error:Problem: problem with installed package epel-aliyuncs-release-8-15.1.al8.noarch- package epel-aliyuncs-release-8-15.1.al8.noarch from @System conflicts with epel-release provided by epel-release-8-22.el8.noarch from epel- package epel-aliyuncs-release-8-15.1.al8.noarch from alinux3-updates conflicts with epel-release provided by epel-release-8-22.el8.noarch from epel- conflicting requests
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

这个错误是因为系统中已经存在名为 epel-aliyuncs-release 的包,与标准的 epel-release 包冲突。

从包的名称来看,是阿里云自己兼容的epel,所以直接进行下一步。

安装certbot。

[ecs-user@iZbp18zmckjuyndr4e25koZ server_crystalsearch]$ sudo yum install -y certbot

使用 Standalone 模式(需临时停止占用 80/443 端口的服务),获取SSL证书。

[ecs-user@iZbp18zmckjuyndr4e25koZ ~]$ sudo certbot certonly --standalone -d fxxkrock.top
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)(Enter 'c' to cancel): 18015262576@189.cn- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.5-February-24-2025.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: n
Account registered.
Requesting a certificate for fxxkrock.topCertbot failed to authenticate some domains (authenticator: standalone). The Certificate Authority reported these problems:Domain: fxxkrock.topType:   connectionDetail: 47.97.27.78: Fetching http://fxxkrock.top/.well-known/acme-challenge/DqitmUHBr-4eEkBcNWoEZWzAf10C8Gwpm5ipvFxoY1U: Timeout during connect (likely firewall problem)Hint: The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on port 80. Ensure that the listed domains point to this machine and that it can accept inbound connections from the internet.Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

报错了。从提示看,也就是网不通,要从80端口访问。

Certbot 的 Webroot 模式 和 Standalone 模式的区别

Webroot 模式
  1. 工作原理

    • 在您的网站根目录创建临时验证文件(/.well-known/acme-challenge/
    • Let’s Encrypt 服务器通过 HTTP 访问这些文件验证域名所有权
    • 需要指定网站根目录路径(如 -w /var/www/your-site
  2. 为什么需要路径

    • Certbot 需要将验证文件写入指定目录
    • Web 服务器(Nginx/Apache/Node.js)必须能通过 HTTP 80 端口访问这些文件
    • 例如:http://your-domain.com/.well-known/acme-challenge/xxxxx
  3. 优势

    • 无需停止正在运行的 Web 服务
    • 适合生产环境(服务持续可用)
    • 可与现有 Web 服务器配合使用
  4. 适用场景

    • 已有 Web 服务器运行中
    • 无法临时停止服务
    • 可访问网站根目录
Standalone 模式
  1. 工作原理

    • Certbot 自己启动临时 Web 服务器(监听 80/443 端口)
    • 直接响应 Let’s Encrypt 的验证请求
    • 无需指定路径
  2. 为什么不需要路径

    • Certbot 完全自己处理验证请求
    • 不依赖现有 Web 服务器或文件系统
    • 验证过程在内存中完成,不写入文件
  3. 优势

    • 简单快速,无需配置 Web 服务器
    • 不依赖现有网站目录结构
    • 适合无 Web 服务器的环境
  4. 代价

    • 临时停止占用 80/443 端口的服务
    • 获取证书期间服务短暂中断
    • 不适合 7x24 小时运行的关键服务

技术对比表

特性Webroot 模式Standalone 模式
需要路径✓ (必须指定网站根目录)✗ (完全自包含)
需停止服务✓ (释放80/443端口)
验证方式通过现有Web服务器访问文件自建临时Web服务器响应请求
适合场景生产环境/服务不可中断测试环境/简单快速获取证书
依赖Web服务器✓ (需配置访问.well-known目录)
证书续期影响零中断短暂中断(约10-30秒)

Node.js 场景下的最佳实践

推荐方案:Webroot 模式
# 1. 创建验证目录
sudo mkdir -p /var/www/ssl_validation/.well-known/acme-challenge# 2. 在Node.js中添加路由处理验证
const app = express();
app.get('/.well-known/acme-challenge/:token', (req, res) => {res.sendFile(`/var/www/ssl_validation/.well-known/acme-challenge/${req.params.token}`);
});# 3. 获取证书
sudo certbot certonly --webroot -w /var/www/ssl_validation -d your-domain.com
Standalone 模式应急使用:
# 1. 停止Node.js服务
sudo systemctl stop node-app# 2. 获取证书(Standalone模式)
sudo certbot certonly --standalone -d your-domain.com --preferred-challenges http# 3. 重启服务
sudo systemctl start node-app

为什么 Standalone 不需要路径?深层解释

Standalone 模式的工作流程:

  1. Certbot 启动内置的微型 HTTP 服务器(Python实现)

  2. 监听 80 端口(HTTP验证)或 443 端口(TLS-ALPN验证)

  3. 当 Let’s Encrypt 发送验证请求时:

    LE Server Certbot 请求 http://domain.com/.well-known/acme-challenge/token123 即时生成并返回验证内容 LE Server Certbot
  4. 验证通过后立即销毁临时服务器

  5. 全程不涉及文件系统操作,所有验证内容在内存中动态生成

这种设计使得 Standalone 模式:

  • 完全独立于现有 Web 基础设施
  • 不需要配置任何文件路径
  • 但要求独占端口(需临时停止其他服务)

实际应用建议

对于 Node.js 项目,推荐组合方案:

  1. 首次获取证书:使用 Standalone 模式(简单快速)

    sudo systemctl stop node-app
    sudo certbot certonly --standalone -d your-domain.com
    sudo systemctl start node-app
    
  2. 证书续期:改用 Webroot 模式(无中断)

    // 在Express中添加验证路由
    app.use('/.well-known/acme-challenge', express.static('/etc/letsencrypt/webrootauth'));
    
    # 续期配置
    sudo certbot renew --webroot -w /etc/letsencrypt/webrootauth
    
  3. 终极方案:用 Nginx 处理验证(最佳实践)

    server {listen 80;server_name your-domain.com;location /.well-known/acme-challenge {root /var/www/certbot;}location / {return 301 https://$host$request_uri;}
    }
    

    这样 Node.js 只需专注 443 端口 HTTPS 服务,完全解耦证书管理。

从资料看,在过程中,80/443 端口都要使用。

安全设备进出都开启80/443。

[ecs-user@iZbp18zmckjuyndr4e25koZ ~]$ sudo certbot certonly --standalone -d fxxkrock.top
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for fxxkrock.topSuccessfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/fxxkrock.top/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/fxxkrock.top/privkey.pem
This certificate expires on 2025-08-28.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:* Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate* Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

需要记录其中 Certificate 和 Key 的保存位置,web应用需要加载这两个文件。

修改web应用的代码

// 添加https模块
const https = require('https');// 读取SSL证书文件
const credentials = {key: fs.readFileSync('/etc/letsencrypt/live/fxxkrock.top/privkey.pem'),cert: fs.readFileSync('/etc/letsencrypt/live/fxxkrock.top/fullchain.pem')
};
// 设置端口号
const port = 3080;// 创建HTTPS服务器
const server = https.createServer(credentials, app).listen(port, () => {console.log(`HTTPS server successfully launched: https://localhost:${port}`);
});

启动web应用

权限不够,无法读取SSL证书

[ecs-user@iZbp18zmckjuyndr4e25koZ server_crystalsearch]$ node server.js
node:fs:562return binding.open(^Error: EACCES: permission denied, open '/etc/letsencrypt/live/fxxkrock.top/privkey.pem'at Object.openSync (node:fs:562:18)at Object.readFileSync (node:fs:446:35)at Object.<anonymous> (/home/ecs-user/server_crystalsearch/server.js:103:13)at Module._compile (node:internal/modules/cjs/loader:1730:14)at Object..js (node:internal/modules/cjs/loader:1895:10)at Module.load (node:internal/modules/cjs/loader:1465:32)at Function._load (node:internal/modules/cjs/loader:1282:12)at TracingChannel.traceSync (node:diagnostics_channel:322:14)at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5) {errno: -13,code: 'EACCES',syscall: 'open',path: '/etc/letsencrypt/live/fxxkrock.top/privkey.pem'
}Node.js v22.15.1

复制这两证书到网站目录,并修改js代码,把文件路径改为新路径。

[ecs-user@iZbp18zmckjuyndr4e25koZ server_crystalsearch]$ sudo cp /etc/letsencrypt/live/fxxkrock.top/privkey.pem /home/ec
s-user/server_crystalsearch/privkey.pem
[ecs-user@iZbp18zmckjuyndr4e25koZ server_crystalsearch]$ sudo cp /etc/letsencrypt/live/fxxkrock.top/fullchain.pem /home/
ecs-user/server_crystalsearch/fullchain.pem

启动过程无报错

[ecs-user@iZbp18zmckjuyndr4e25koZ server_crystalsearch]$ node server.js
Web folder:  /home/ecs-user/server_crystalsearch/crystalsearch
HTTPS server successfully launched: https://localhost:3060

浏览器访问http://fxxkrock.top:3060/,浏览器显示“响应时间过长”。

访问https://fxxkrock.top:3060/,浏览器显示“响应时间过长”。

忘记在安全设备打开3060端口了。

打开后,https正常,控制台无报错。

访问http会自动跳转到https。

http://www.dtcms.com/wzjs/591120.html

相关文章:

  • 怎么看一个网站用什么做的营销的手段和方法
  • 开发网站建设有网站的源代码怎么生成网站
  • 网站开发+语音网站建设公司接单
  • 新手做自己的网站教程中国建设银行网站首页下载
  • 甘肃省建设局网站360百度网站怎么做
  • flashfxp 网站廊坊市固安县建设局网站
  • 最新网站发布win主机怎样实现wordpress固定链接静态化
  • 网站代备案需要多少钱阿里云服务器建立网站吗
  • 网站建设移动网络用织梦做的网站是模板的吗
  • wordpress post_type网站优化对企业有什么好处
  • 营销类网站有哪些长春企业网站设计
  • 我的企业网站怎么seo网站开发公司分析
  • 展示型网站系统中山网官网
  • 最专业的做网站公司有哪些百度网站app下载
  • 深圳专业做网站技术唐山快速建站的公司
  • 上海网站建设高端遵义网帮你分类信息网
  • 怎么检查网站死链创建有限公司
  • 做网站需要购买什么深圳网站优化推广
  • 织梦茶叶网站模板特色化示范性软件学院
  • 云南网站建设找三好科技公司网站域名及空间
  • 局网站建设情况汇报哪些购物网站做的比较简洁有品质
  • 什么网站可以在线做雅思制作商城网站公司
  • 网站开发给网站设置图标在什么文件中写代码怎样做网络推广话术
  • 新网站怎么做才会被收录网站开发 报价单 表格
  • 建站之星设计师网络科技服务公司
  • dw做网站站点wordpress 文章 接口
  • h5网站开发培训机构北京网站开发培训
  • 昆明网站设计制造用wordpress做企业网站
  • 如何给网站刷流量seo在线网站推广
  • 大庆网站建设公司软件开发培训计划