DEV Community

Pranjal Sharma
Pranjal Sharma

Posted on

Automating Nginx Installation on a Fresh Debian Server

I started building a small Linux server administration project around managing a Debian VPS from the command line.

For the first step, I created a Bash script that automates the initial Nginx installation:

!/usr/bin/env bash

set -euo pipefail

sudo apt update
sudo apt install -y nginx
sudo systemctl enable nginx
sudo systemctl start nginx
sudo nginx -t

The script handles the basic setup:

Updates the package index
Installs Nginx
Enables Nginx at boot
Starts the service
Validates the configuration

I tested it on a fresh Debian 13 server environment and used systemctl, nginx -t, and curl to verify the installation.

The interesting part isn't the installation itself. I'm using this as the starting point for a more practical server administration lab covering:

→ SSH administration
→ Server hardening
→ UFW/firewall configuration
→ Nginx server blocks
→ DNS and SSL/TLS
→ Reverse proxying
→ Logging and monitoring
→ Backups and restoration
→ Troubleshooting real failure scenarios

GitHub: github.com/psdojo/nginx-scripts

This is the first step toward building a documented, repeatable Linux server management workflow.

Top comments (0)