Deploy apps · 8 min
Host a static website with Nginx
Serve HTML, CSS and JavaScript files fast with Nginx.
Perfect for landing pages, portfolios, documentation and apps built to static files (like React or Vite builds).
1. Install Nginx
sudo apt update && sudo apt install -y nginxOpen http://your-server-ip/: you should see the Nginx welcome page. (Allow Web (HTTP) in the firewall if it's on.)
2. Upload your site
From your computer, copy your files to the server:
scp -r ./dist/* root@203.0.113.10:/var/www/html/3. Configure your domain
sudo tee /etc/nginx/sites-available/site > /dev/null <<'EOF'
server {
listen 80;
server_name example.com www.example.com;
root /var/www/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/site /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t && sudo systemctl reload nginxtry_files ... /index.html makes single-page apps work on every URL.
4. Add HTTPS
Point your domain to the server, then follow Free HTTPS with Let's Encrypt.
Stuck? Contact us or open a support ticket from your panel.