DEV Community

Cover image for 10 Practical Ways to Secure a VPS Server
V. S.
V. S.

Posted on

10 Practical Ways to Secure a VPS Server

Developers often deploy a VPS and focus immediately on application code.

Security usually comes later.

That is backwards.

  1. Disable Password Authentication

PasswordAuthentication no

  1. Use SSH Keys

ssh-keygen -t ed25519

  1. Restrict Open Ports

Only expose:

SSH
HTTP
HTTPS
Enter fullscreen mode Exit fullscreen mode
  1. Install Fail2Ban

apt install fail2ban

  1. Enable Auto Security Updates

apt install unattended-upgrades

  1. Use Non-Root Users

Never deploy apps as root.

  1. Harden NGINX

Add:

Rate limits
Headers
TLS best practices
Enter fullscreen mode Exit fullscreen mode
  1. Monitor Logs

Security visibility matters.

  1. Back Up Everything

Recovery is part of security.

  1. Audit Regularly

Security is ongoing maintenance.
Example Secure Baseline Stack

Ubuntu
UFW
Fail2Ban
SSH Keys
Backups
Monitoring

Developer Takeaway

Good VPS security is mostly about doing basics consistently.

Complexity is often unnecessary.

Developers managing infrastructure remotely may also benefit from a Dedicated IP VPN for secure connections.

Top comments (0)