主题
常用命令
安装与开发
bash
# 安装依赖(四个站点分别装)
cd pc-web && npm install
cd mobile-web && npm install
cd docs-site && npm install
cd blog-site && npm install
# 开发
cd pc-web && npm run dev # http://localhost:5173
cd mobile-web && npm run dev # http://localhost:5174
cd docs-site && npm run dev # http://localhost:5173
cd blog-site && npm run dev # http://localhost:5173构建
bash
cd pc-web && npm run build # gen-pages → 彩票抓取 → vite build → postbuild
cd mobile-web && npm run build
cd docs-site && npm run build
cd blog-site && npm run build单独执行某一步:
bash
cd pc-web
npm run gen # 只生成 HTML
npm run lottery:update # 只更新彩票数据
node scripts/postbuild.mjs # 只整理产物目录发布
bash
./deploy.sh # 主站两端
./deploy.sh pc # 电脑版
./deploy.sh mobile # 手机版
./deploy.sh docs # 文档站
./deploy.sh blog # 随笔站
./deploy.sh sites # 子域 nginx + 证书
./deploy.sh nginx # 主站 nginx
./deploy.sh --skip-build # 用现有 dist
./deploy.sh --dry-run # 只看计划
./deploy.sh nginx --force # 强制重写配置服务器
bash
ssh root@121.43.28.40
nginx -t # 校验配置
systemctl reload nginx # 平滑重载
systemctl status nginx
ls /etc/nginx/conf.d/
ls /var/www/
ls -1t /var/www/.releases/ | head
tail -f /var/log/nginx/error.log
tail -f /var/log/nginx/emphant.access.log证书
bash
certbot certificates
certbot renew --dry-run
certbot certonly --nginx --cert-name emphant.com \
-d emphant.com -d www.emphant.com -d m.emphant.com \
-d docs.emphant.com -d blog.emphant.com验证
bash
curl -I https://emphant.com/
curl -I https://emphant.com/text/word-counter/
curl -I https://emphant.com/m/
curl -I https://docs.emphant.com/guide/
curl -I https://blog.emphant.com/
curl -I https://blog.emphant.com/rss.xml
# 手机 UA 分流
curl -A "iPhone" -I https://emphant.com/text/word-counter/
# 证书
echo | openssl s_client -connect docs.emphant.com:443 \
-servername docs.emphant.com 2>/dev/null | openssl x509 -noout -dates本地预览产物
bash
npx serve pc-web/dist
npx serve mobile-web/dist -p 4173
npx vitepress preview docs-site
npx vitepress preview blog-site