SSL 证书
HTTPS 对 FeedbackPulse SaaS 来说至关重要,它保护传输过程中的登录凭据、支付数据和客户信息。
方案一:Let's Encrypt(免费且推荐)
单域名证书
# 安装 Certbot
sudo apt install certbot
# 用于 Nginx:
sudo apt install python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
# 用于 Apache:
sudo apt install python3-certbot-apache
sudo certbot --apache -d yourdomain.com -d www.yourdomain.com
Certbot 会:
- 获取证书
- 自动配置您的 Web 服务器
- 设置自动续期(通过 systemd 定时器)
通配符证书(子域名)
请参阅通配符 DNS 配置中的详细说明。
验证自动续期
# 测试续期(演习模式)
sudo certbot renew --dry-run
# 检查定时器状态
sudo systemctl status certbot.timer
方案二:付费 SSL 证书
如果您偏好使用付费证书:
- 生成 CSR(证书签名请求):
openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr
- 将 CSR 提交给您的证书提供商
- 下载证书文件
- 在 Web 服务器配置中安装证书
方案三:Cloudflare SSL(免费)
如果您的域名使用 Cloudflare:
- 在 Cloudflare 控制台 → SSL/TLS
- 将模式设置为 Full(Strict)
- Cloudflare 负责访客到 Cloudflare 之间的 SSL
- 使用 Cloudflare Origin 证书处理 Cloudflare 到您服务器之间的连接
SSL 配置后续步骤
启用 SSL 后,更新您的 .env:
APP_URL=https://yourdomain.com
SESSION_SECURE_COOKIE=true