Documentation Index
Fetch the complete documentation index at: https://mintlify.com/vuejs/vitepress/llms.txt
Use this file to discover all available pages before exploring further.
Deploying Your VitePress Site
VitePress generates static HTML files that can be deployed to any hosting platform. This guide covers building for production and deploying to popular platforms.Prerequisites
These deployment guides assume:- VitePress site is in the
docsdirectory - Using default build output directory (
.vitepress/dist) - VitePress installed as a local dependency
- npm scripts configured in
package.json:
package.json
Build and Test Locally
Preview locally
Test the production build before deploying:The preview server runs at
http://localhost:4173.Setting a Public Base Path
If your site is served from a subdirectory, set thebase option:
.vitepress/config.js
GitHub Pages example: Deploying to
user.github.io/repo/ requires base: '/repo/'HTTP Cache Headers
Optimize performance with proper cache headers for static assets.Understanding Asset Hashing
VitePress uses content-based hashing for assets:Recommended Cache Headers
For files in theassets/ directory:
- Netlify
- Vercel
- Nginx
Platform-Specific Guides
Netlify / Vercel / Cloudflare Pages / AWS Amplify / Render
These platforms work similarly - configure via dashboard:Configure build settings
- Build Command:
npm run docs:build - Output Directory:
docs/.vitepress/dist - Node Version:
20(or above)
GitHub Pages
Deploy automatically using GitHub Actions:For pnpm or yarn, uncomment the relevant sections in the workflow file and update the cache and install commands.
GitLab Pages
Deploy using GitLab CI:Azure Static Web Apps
Follow Azure documentation
See the official Azure Static Web Apps guide.
Firebase
Create Firebase config
Create
firebase.json and .firebaserc in your repository root:firebase.json
.firebaserc
Surge
Quick deployment with Surge:Custom Nginx Server
Example Nginx configuration with gzip compression and proper caching:This assumes your built site is in
/app. Adjust the root directive for your setup.Additional Platforms
CloudRay
Deploy with CloudRay - follow their VitePress guide
Hostinger
Deploy to Hostinger - see their deployment guide
Kinsta
Deploy to Kinsta - follow their VitePress example
Stormkit
Deploy to Stormkit - see their deployment guide
Build Options
Customize the build process with command-line options:Output Directory
Change the build output location:.vitepress/config.js
Base Path at Build Time
Override the base path during build:MPA Mode
Build as a traditional multi-page application (disables client-side routing):.vitepress/config.js
Troubleshooting
Build Fails on CI
Ensure Node.js version 18 or higher:404 on Deployment
Check your base path configuration matches your hosting setup:- Root domain:
base: '/'(default) - Subdirectory:
base: '/subdirectory/'
Assets Not Loading
Verify:- Base path includes trailing slash:
base: '/repo/'not'/repo' - Assets are in
docs/public/or imported in components - Cache headers are properly configured
Clean URLs Not Working
Enable clean URL support on your hosting platform or disable in config:.vitepress/config.js
Next Steps
Performance Optimization
Learn how to optimize your VitePress site for maximum performance
Custom Domain
Set up a custom domain for your deployed site
Analytics
Add analytics tracking to your VitePress site
SEO
Optimize your site for search engines