Quick answer: Install Nginx from your distribution's repository — sudo apt install nginx on Ubuntu/Debian or sudo dnf install nginx on AlmaLinux/Rocky — then enable it with systemctl enable --now nginx and open ports 80/443 in the firewall.
Overview
Nginx is the most popular web server and reverse proxy on Linux VPS: fast, memory-efficient and simple to configure once you know the layout. It serves static sites directly and proxies dynamic apps (PHP-FPM, Node.js, Python) behind it.
Before you start
- A Linux server with root/sudo access.
- No other web server bound to port 80 (check with
sudo ss -tlnp | grep :80). - Optionally a domain pointed at your server IP.
Step-by-step guide
- Install:
# Ubuntu/Debian sudo apt update && sudo apt -y install nginx # AlmaLinux/Rocky sudo dnf -y install nginx - Enable and start:
sudo systemctl enable --now nginx systemctl status nginx - Open the firewall:
# UFW (Ubuntu/Debian) sudo ufw allow 80/tcp && sudo ufw allow 443/tcp # firewalld (Alma/Rocky) sudo firewall-cmd --permanent --add-service=http --add-service=https && sudo firewall-cmd --reload - Visit
http://YOUR_SERVER_IP— you should see the Nginx welcome page. - Add your site: create a server block in
/etc/nginx/sites-available/(Debian family) or/etc/nginx/conf.d/(RHEL family), then test and reload:sudo nginx -t && sudo systemctl reload nginx
Common issues
- Port 80 already in use: Apache may be running — stop/disable it or change ports.
- Config error on reload: always run
nginx -tfirst; it names the bad line. - 403/404 on your site: check
rootpath and file permissions; on RHEL family also SELinux contexts.
When to contact support
Software configuration on an unmanaged server is up to you, but if the server itself is unreachable or you suspect a network issue, open a ticket.
Frequently asked questions
Should I choose Nginx or Apache?
Nginx is lighter and faster at high concurrency and is the usual default today. Choose Apache when your application depends on .htaccess files or Apache-specific modules.
Why do I see the Nginx welcome page instead of my site?
Your server block is not active yet. Check the root path, enable the site config, then run "nginx -t" and reload — the default site answers until yours matches the request.
How do I add HTTPS to Nginx?
Install a free Let's Encrypt certificate with certbot: "apt install certbot python3-certbot-nginx" then "certbot --nginx" configures HTTPS and renewal automatically.
Related articles
- How to install PHP
- How to install Apache
- How to install MariaDB or MySQL
- How to configure UFW firewall
Ready to get started? Order a VPS at Cloud2Y →
