Securing a new LAMP/LEMP server

October 28, 2013 4.3k views
I’ve finished configuration on a new LEMP server and wonder: what measures do folks suggest for securing my new VPS? Root login is disabled, I’m using strong passwords and fail2ban is enabled. What else might I want configure/enable?
3 Answers
From serverfault | Why change default ssh port?

Whatever port you chose, if you do move away from 22, make sure it is below 1024. Under most Unix-a-like setups in their default config, only root (or users in the root group) can listen on ports below 1024, but any user can listen on the higher ports. Running SSH on a higher port increases the chance of a rogue (or hacked) user managing to crash your SSH daemon and replace it with their own or a proxy.
1.) Disable password logins and use key-based authentication, instead;
2.) Change your SSH port from the default Port 22 to a random port below 1024; and
3.) Enable a firewall.

Check out the Security Hardening section of Automated Provisioning of DigitalOcean Cloud Servers with Salt Cloud on Ubuntu 12.04
Apologies for hijacking this thread

@Pablo, I bow to your greater knowledge, why use a port below 1024?
Have another answer? Share your knowledge.