NolimitHost
Last updated: March 29, 2026
Nginx is a fast, lightweight web server perfect for hosting websites and web applications. This guide covers installation and basic configuration with your own domain.
Update your system:
sudo apt update && sudo apt upgrade -y
Install Nginx:
sudo apt install -y nginx
Allow HTTP traffic (port 80):
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 22/tcp
sudo ufw enable
Verify the rules:
sudo ufw status
Note: When setting up HTTPS later, you'll also open port 443 (HTTPS).
Check Nginx status:
sudo systemctl status nginx
Visit http://your.vps.ip.address in your browser to see the Nginx welcome page.
Create a directory for your website files:
sudo mkdir -p /var/www/example.com/html
sudo chown -R $USER:$USER /var/www/example.com/html
Replace example.com with your actual domain.
Create your index.html file:
nano /var/www/example.com/html/index.html
Add this content:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to My Site</title>
</head>
<body>
<h1>Hello from Nginx!</h1>
<p>Your website is live.</p>
</body>
</html>
Save with Ctrl+X Y Enter.
Create a server block configuration for your domain:
sudo nano /etc/nginx/sites-available/example.com
Add this configuration (replace example.com with YOUR domain):
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example.com/html;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
Save the file.
Enable the server block by creating a symlink:
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
Remove the default Nginx configuration:
sudo rm /etc/nginx/sites-enabled/default /etc/nginx/sites-available/default
Edit the main Nginx config:
sudo nano /etc/nginx/nginx.conf
Find the line # server_names_hash_bucket_size 64; and uncomment it (remove the #).
Test the configuration:
sudo nginx -t
You should see:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Reload Nginx to apply changes:
sudo systemctl reload nginx
In your domain registrar's DNS settings, add an A record:
DNS propagation takes 15 minutes to a few hours. Once complete, visiting your domain in a browser will show your website.
Check status:
sudo systemctl status nginx
Stop/Start/Restart:
sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl restart nginx
Enable auto-start on reboot:
sudo systemctl enable nginx
After your website is running:
topFor Nginx configuration assistance, please open a support ticket through your billing panel.
This website uses cookies to ensure security, session management, and basic functionality. For details on all cookies used and how to manage your preferences, please see our Privacy Policy.