rwadurian/frontend/mining-admin-web/nginx/README.md

1.9 KiB

RWA Mining Admin Web - Nginx 部署指南

域名

  • 域名: madmin.szaiai.com
  • 端口: 3100

快速部署

1. 启动 Docker 应用

cd frontend/mining-admin-web
./deploy.sh start

2. 配置 DNS

将域名 madmin.szaiai.com 的 A 记录指向服务器 IP。

3. 运行安装脚本

cd nginx
sudo ./install.sh

脚本会自动完成:

  • 安装 Nginx
  • 安装 Certbot
  • 配置防火墙
  • 申请 Let's Encrypt SSL 证书
  • 配置 HTTPS

手动部署

1. 安装 Nginx 和 Certbot

sudo apt update
sudo apt install -y nginx certbot python3-certbot-nginx

2. 复制 Nginx 配置

sudo cp madmin.szaiai.com.conf /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-available/madmin.szaiai.com.conf /etc/nginx/sites-enabled/

3. 申请 SSL 证书

sudo mkdir -p /var/www/certbot
sudo certbot certonly --webroot -w /var/www/certbot -d madmin.szaiai.com

4. 启用 HTTPS 配置

sudo nginx -t
sudo systemctl reload nginx

常用命令

# 查看 Nginx 状态
sudo systemctl status nginx

# 重载配置
sudo systemctl reload nginx

# 查看证书
sudo certbot certificates

# 手动续期测试
sudo certbot renew --dry-run

# 查看访问日志
sudo tail -f /var/log/nginx/madmin.szaiai.com.access.log

# 查看错误日志
sudo tail -f /var/log/nginx/madmin.szaiai.com.error.log

证书自动续期

Certbot 安装后会自动配置 systemd timer 进行证书续期:

# 查看续期定时器状态
sudo systemctl status certbot.timer

# 手动测试续期
sudo certbot renew --dry-run

文件说明

文件 说明
madmin.szaiai.com.conf Nginx 配置文件
install.sh 一键安装脚本
README.md 本文档

架构

Internet
    ↓
Nginx (443/SSL - Let's Encrypt)
    ↓
Docker Container (3100/HTTP)
    ↓
Next.js Application