CloudLinux.ro
Web servers

How to install Nginx and host your first site

Updated 7/20/2026

Nginx is the most widely used web server for fast, modern sites. Here is how to install it and publish your first site.

1. Install

apt-get update -y
apt-get install -y nginx
systemctl enable --now nginx

Open the server IP in a browser: you should see the default Nginx page.

2. Add your site files

mkdir -p /var/www/mysite
echo "It works!" > /var/www/mysite/index.html

3. Configure a server block

Create /etc/nginx/sites-available/mysite:

server {
    listen 80;
    server_name example.com www.example.com;
    root /var/www/mysite;
    index index.html;
}
ln -s /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx

Next steps

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 pricing

Related tutorials