Prerequisites
Before installing Nginx, make sure you have:
- SSH access to your VPS
- Root or sudo privileges
Install Nginx on Ubuntu/Debian
Connect to your VPS:
ssh hxroot@YOUR_SERVER_IP -p 22
apt update
apt install nginx -y
Start and Enable Nginx
systemctl start nginx
systemctl enable nginx
Configure Firewall
ufw allow 80/tcp
ufw allow 443/tcp
Verify Nginx is Running
systemctl status nginx
Visit your server IP in browser - you should see the Nginx welcome page.
Nginx Configuration Files
Main config: /etc/nginx/nginx.conf
Sites available: /etc/nginx/sites-available/
Sites enabled: /etc/nginx/sites-enabled/
✅ Nginx web server has been installed.