How To Install Nginx On Debian 13 Trixie
Nginx is one of the most widely used web servers in the world, known for its high performance, lightweight resource usage, and excellent stability for high-traffic websites. On Debian 13 (Trixie), installing Nginx is straightforward because the official repository already provides an up-to-date version.
This article provides a complete guide on how to install, configure, and run Nginx on Debian 13, suitable for beginners and server administrators.
1. Update Your Debian 13 System
Before installing Nginx, update your system packages :
sudo apt update && sudo apt upgrade -yThis ensures your server has the latest dependencies.
2. Install Nginx On Debian 13
Debian 13 includes Nnginx directly in its official repository. Install it with :
sudo apt install nginx -yOnce finished, Nginx will be installed and ready to use.
3. Check Nginx Service Status
Verify that Nginx is running :
sudo systemctl status nginxIf it's active, you should see :
active (running)4. Enable Nginx To Start Automatically
Ensure Nginx runs on every server reboot :
sudo systemctl enable nginx5. Access The Nginx Default Web Page
Open your browser and visit :
http://YOUR_SERVER_IPIf installation was successful, you'll see the default Welcome to Nginx page.
6. Manage Nginx (Start, Stop, Restart)
Use the following commands to control Nginx :
Start Nginx
sudo systemctl start nginxStop Nginx
sudo systemctl stop nginxRestart Nginx
sudo systemctl restart nginxReload configuration without downtime
sudo systemctl reload nginx7. Important Nginx Directories On Debian 13
| Path | Description |
|---|---|
| /etc/nginx/nginx.conf | Main Nginx configuration file |
| /etc/nginx/sites-available/ | Virtual host configuration files |
| /etc/nginx/sites-enabled/ | Active virtual host symlinks |
| /var/www/html/ | Default web root |
| /var/log/nginx/ | Access & error logs |
These paths follow the standard Debian Nginx structure.
8. Configure Firewall For Nginx (Optional)
If you use ufw, allow Nginx HTTP and HTTPS traffic :
sudo ufw allow 'Nginx Full'
sudo ufw reload9. Create A Virtual Host For Your Domain
Create a new configuration file :
sudo nano /etc/nginx/sites-available/yourdomain.comBasic configuration :
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
root /var/www/yourdomain.com;
index index.html index.php;
location / {
try_files $uri $uri/ =404;
}
}Enable the site :
sudo ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/Check configuration :
sudo nginx -tReload Nginx :
sudo systemctl reload nginx10. Add Free SSL Using Certbot (Optional)
Install Certbot :
sudo apt install certbot python3-certbot-nginx -yEnable HTTPS :
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.comYour website will now use HTTPS automatically.
Conclusion
Installing Nginx on Debian 13 (Trixie) is simple and fast. After completing these steps, your server is ready to host websites, applications, APIs, and more. You can now proceed with setting up PHP, MariaDB, or deploying your web applications.






