Nginx: installation and your first site
How to install Nginx on Millida VDS, serve your first page at your own address, and avoid breaking the configuration with a typo.
Updated August 23, 2026
Nginx is the most common web server: it serves static files and proxies requests to applications. At any VPS tier, it takes up tens of megabytes of memory, so even VDS-1 will do.
Installation
Connect to the machine via SSH (the command is on the “Overview” tab in the panel /hosting/vds/m/<id>) and install the package.
apt update && apt install -y nginx # Debian, Ubuntu
dnf install -y nginx && systemctl enable --now nginx # AlmaLinux, CentOS Stream
Check that the service is up:
systemctl status nginx
curl -I http://127.0.0.1
Now open the machine's public address in your browser—it's shown in “Overview”. The Nginx welcome page should appear.
Your first site
Don't edit the default file—create a separate config for each site. This makes them easier to enable and disable.
mkdir -p /var/www/example.ru
echo '<h1>Works</h1>' > /var/www/example.ru/index.html
chown -R www-data:www-data /var/www/example.ru
server {
listen 80;
server_name example.ru www.example.ru;
root /var/www/example.ru;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
Save this to /etc/nginx/sites-available/example.ru (on AlmaLinux, /etc/nginx/conf.d/example.ru.conf) and enable it:
ln -s /etc/nginx/sites-available/example.ru /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
nginx -t is a mandatory step. It checks the syntax before reloading; without it, a bracket error will bring down all sites at once.
Domain and certificate
Point the domain's A record to the machine address from “Overview”. Until the record propagates, the site is only accessible by IP. The reverse record (PTR) is configured on the “Access” tab; it doesn't affect the site's operation—only email reputation.
Next, install a free certificate: Let's Encrypt. Without it, browsers show “Not secure”.
Common errors
| Symptom | Cause | What to do |
|---|---|---|
403 Forbidden | No permissions on the directory or no index.html | chown -R www-data:www-data /var/www/..., check index |
502 Bad Gateway | The application behind the proxy isn't running | systemctl status of your service, see reverse proxy |
| A different site opens | The request didn't match any server_name and hit the first block | Explicitly set server_name, remove default_server from the extra config |
| Port 80 is in use | Apache is already installed | Disable it: systemctl disable --now apache2 |
Check the logs in /var/log/nginx/error.log—that's where the cause of almost any 500 response is.
Restart Nginx with
systemctl reload, notrestart: reload picks up the configuration without dropping open connections.