个人随笔记录站点。
在 .env
中添加以下变量:
DATABASE_URL= # 精确到数据库名,mongodb://<username>:<password>@<host>:<port>/<database>
BLOG_ASSET_PATH= # 资源相对路径
BLOG_VISIT_KEY= # 用于生成 Cookie
VITE_TIMEZONE= # 默认显示时区,https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
npm install
npm run build
sudo npm install --global pm2
PORT=<PORT> pm2 start build/index.js --name drift
pm2 startup
pm2 save
server {
server_name <DOMAIN>;
location / {
proxy_pass http://localhost:<PORT>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $http_x_forwarded_for; # For CDN
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}