Skip to content
VDS · Websites and web servers

Static site: from file to domain

The complete path for a landing page or a React or Vue build: upload files to a VPS, serve them with a web server, bind a domain, and update without downtime.

Updated August 23, 2026

A static site is a set of ready-made files: HTML, CSS, images, a frontend build. It needs neither PHP nor a database, so it runs comfortably even on VDS-1 and handles noticeable traffic: up to 500 Mbit/s.

Where to put the files

Create a separate directory for each site:

mkdir -p /var/www/example.ru
chown -R www-data:www-data /var/www/example.ru

Upload from your local machine with plain scp or rsync:

scp -r ./dist/* root@YOUR_ADDRESS:/var/www/example.ru/
rsync -avz --delete ./dist/ root@YOUR_ADDRESS:/var/www/example.ru/

rsync --delete removes files on the server that are no longer in the build. Without it, old JS chunks pile up for years.

Serving via the web server

Minimal Nginx config:

server {
    listen 80;
    server_name example.ru;
    root /var/www/example.ru;
    index index.html;

    location / {
        try_files $uri $uri/ /index.html;
    }

    location ~* \.(js|css|png|jpg|svg|woff2)$ {
        expires 30d;
        add_header Cache-Control "public, immutable";
    }
}

The try_files ... /index.html line is needed for single-page applications built on React, Vue and Svelte: without it, going straight to /about returns a 404.

Next comes a Let's Encrypt certificate, and the site opens over HTTPS.

Domain

In the domain panel, create an A record pointing to the machine's public address (the “Overview” tab in /hosting/vds/m/<id>) and the same record for www. Check:

dig +short example.ru

Records can take up to several hours to propagate. While you wait, the site is reachable at the machine's address.

Updating without downtime

Don't upload files on top of a live directory — a visitor may catch a half-built site. Build alongside and switch the symlink:

rsync -avz ./dist/ /var/www/releases/$(date +%s)/
ln -sfn /var/www/releases/1724400000 /var/www/example.ru-current
systemctl reload nginx

The root in the config then points to /var/www/example.ru-current.

Common mistakes

SymptomCause
Blank page, 404 on JS in the consoleFiles were built with the wrong base — check your bundler settings
Old version for some visitorsBrowser cache — use hashed file names
403 on everythingThe directory isn't readable by the web server user
Only the home page worksNo try_files for a single-page application

It's better to build the frontend locally and upload the finished dist. On VDS-1 with 2 GB of memory, building a large project can fail due to lack of memory.