VPS Setup and Maintenance Cheat Sheet for Production Apps
· Suroj Dangol ·5 min read
Many small teams treat a VPS as a black box until something breaks. Domain Management, hosted on a private CRM instance, and several internal tools running on Ubuntu VPS servers taught me that a disciplined setup routine prevents most emergency fires.
## SSH hardening basics
Disable password authentication and allow only key-based login. Change the default port only if it helps with noise reduction, but understand it doesn't replace proper access controls. Install and configure `fail2ban` to block repeated failed login attempts automatically. Keep `root` login disabled and administer through a dedicated user with sudo privileges.
These steps alone remove the majority of automated attack surface without affecting legitimate access.
## Automated backups that you have tested restoring from
Configure `rsync` or `borgbackup` to copy application data and database dumps to a separate volume or object storage bucket daily. The critical missing step most teams take is restoring from a backup in a test environment—schedule a quarterly restore drill and document the process. An untested backup is indistinguishable from no backup.
For PostgreSQL databases, `pg_dump` with `--format=custom` produces compact, restore-ready archives. Store these alongside application files.
## Log rotation and disk space monitoring
Applications write logs faster than most operators expect. Configure `logrotate` for your application and JVM logs, keeping seven days of compressed history by default. Set a disk usage alert at 80 percent capacity through a simple cron job checking `df` output and sending an email or Slack notification.
Missing this detail caused a production outage on an early project when log files filled the root partition overnight.
## Minimal monitoring that actually helps
You don't need Prometheus and Grafana for a single-server workload. A small script that checks process uptime, memory usage, and SSL certificate expiry—running every five minutes—catches most degradation patterns. Pair it with a lightweight alert to Telegram or email, and you have coverage that scales reasonably through moderate traffic growth.