How to host a static site or a React/Vue app
Updated 10/23/2026
Static sites and single-page apps (React, Vue, Svelte) are just files: fast, cheap and easy to serve with Nginx.
1. Build it
npm run build
The result is a directory (usually dist or build) with HTML, CSS and JS files.
2. Copy the files to the server
scp -r dist/* root@SERVER_IP:/var/www/mysite/
3. Nginx server block
For a simple static site:
server {
listen 80;
server_name example.com;
root /var/www/mysite;
index index.html;
}
4. Routing for single-page apps
React/Vue apps route on the client. Without this line, refreshing on a route gives a 404:
location / {
try_files $uri $uri/ /index.html;
}
nginx -t && systemctl reload nginx
Add a domain and HTTPS: see How to point a domain and Free SSL certificate.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to optimize Nginx performance: gzip, cache and HTTP/2
Make your site faster with gzip compression, static file caching and HTTP/2, a few lines of config.
Updated 10/23/2026Web serversHow to deploy a Node.js app to production
Run a Node.js app reliably in production with PM2 and Nginx, with auto-restart and HTTPS.
Updated 10/23/2026Web serversHow to host multiple sites on one server
Use Nginx server blocks to run multiple domains on the same VPS, each with its own site.
Updated 10/23/2026