Hexo is a popular Node-based static blog generator. On a VPS you build public/ and serve it without Node in production.
Steps
Install Node.js LTS and the Hexo CLI:
node -v || (curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt install -y nodejs)sudo npm install -g hexo-clihexo versionInitialize the blog and install dependencies:
cd ~ && hexo init hexo-demo && cd hexo-demonpm installGenerate the public/ folder:
hexo generatels publicServe public/ with Nginx:
sudo mkdir -p /var/www/hexo-demosudo rsync -a ~/hexo-demo/public/ /var/www/hexo-demo/sudo tee /etc/nginx/sites-available/hexo-demo >/dev/null <<'EOF'server { listen 80; server_name example.com; root /var/www/hexo-demo; index index.html;}EOFsudo ln -sf /etc/nginx/sites-available/hexo-demo /etc/nginx/sites-enabled/hexo-demosudo nginx -t && sudo systemctl reload nginx
Tips
- After new posts:
hexo generatethen rsyncpublic/again. - Do not expose
hexo serverto the internet — only the static build.
ext step
Run Hexo on your own VPS: Deploy your Cloud VPS.