无限世界生成器实战:从提示词到实时飞行漫游的AI创作指南
2026/10/19 8:55:42
当我们将DeepChat服务部署到公网时,所有数据传输默认都是明文的。这意味着:
TLS(传输层安全协议)加密可以:
首先确认服务器环境:
# 检查Nginx是否安装 nginx -v # 检查是否开放443端口 sudo ufw status如果未安装Nginx,使用以下命令安装:
sudo apt update sudo apt install nginx -yCertbot是Let's Encrypt的官方客户端:
sudo apt install certbot python3-certbot-nginx -y运行以下命令申请证书:
sudo certbot --nginx -d deepchat.example.com按照提示操作:
成功后会显示:
Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/deepchat.example.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/deepchat.example.com/privkey.pem新建配置文件/etc/nginx/sites-available/deepchat:
server { listen 443 ssl; server_name deepchat.example.com; ssl_certificate /etc/letsencrypt/live/deepchat.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/deepchat.example.com/privkey.pem; location / { proxy_pass http://localhost:3000; # DeepChat默认端口 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } } server { listen 80; server_name deepchat.example.com; return 301 https://$host$request_uri; }sudo ln -s /etc/nginx/sites-available/deepchat /etc/nginx/sites-enabled sudo nginx -t # 测试配置 sudo systemctl restart nginx访问https://deepchat.example.com,你应该能看到:
使用openssl验证:
openssl s_client -connect deepchat.example.com:443 -servername deepchat.example.com | grep "Verify"应该看到"Verify return code: 0 (ok)"。
Let's Encrypt证书有效期为90天,设置自动续期:
sudo crontab -e添加以下内容:
0 12 * * * /usr/bin/certbot renew --quiet这会在每天中午检查并续期即将过期的证书。
可能原因:
解决方案:
# 检查域名解析 nslookup deepchat.example.com # 检查端口占用 sudo netstat -tulnp | grep :80 # 临时关闭防火墙 sudo ufw disable检查步骤:
sudo tail -f /var/log/nginx/error.log如果页面加载了HTTP资源,浏览器会显示"不安全"警告。解决方案:
通过本教程,我们完成了:
现在你的DeepChat服务已经具备:
获取更多AI镜像
想探索更多AI镜像和应用场景?访问 CSDN星图镜像广场,提供丰富的预置镜像,覆盖大模型推理、图像生成、视频生成、模型微调等多个领域,支持一键部署。