1.3 KiB
1.3 KiB
HTTPS + Nginx 配置
架构
浏览器 (https://suyushi.top:443)
→ Nginx (端口 80/443)
→ LobeHub 容器 (内部 127.0.0.1:3210)
Nginx 安装
yum install -y nginx
Nginx 配置
文件路径:/etc/nginx/conf.d/lobehub.conf
server {
listen 80;
server_name suyushi.top www.suyushi.top;
location / {
proxy_pass http://127.0.0.1:3210;
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;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Let's Encrypt SSL 证书
安装 Certbot
yum install -y certbot python3-certbot-nginx
签发证书
certbot --nginx -d suyushi.top -d www.suyushi.top --non-interactive --agree-tos --email panghusys2025@gmail.com --redirect
证书自动续期已配置,90天有效,到期前自动更新
启动 Nginx 自启
systemctl enable nginx
端口冲突处理
如果 nginx 起不来报 Address already in use:80:
fuser -k 80/tcp # 杀掉占用端口的进程
systemctl start nginx