How to host a static site or a React/Vue app
Updated 7/20/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 7/20/2026Web serversHow to install phpMyAdmin to manage MySQL from the browser
Manage your MySQL databases from a web interface with phpMyAdmin, installed and secured correctly.
Updated 7/20/2026Web serversHow to deploy a Laravel app to production
Deploy Laravel properly on a VPS: Nginx, PHP-FPM, permissions, optimizations and the queue worker.
Updated 7/20/2026