Securing a new LAMP/LEMP server

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?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

From <a href=“”>serverfault | Why change default ssh port?</a> <br><blockquote> <br>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. <br></blockquote>

Apologies for hijacking this thread <br> <br>@Pablo, I bow to your greater knowledge, why use a port below 1024?

1.) Disable password logins and use key-based authentication, instead; <br>2.) Change your SSH port from the default Port 22 to a random port <b>below 1024</b>; and <br>3.) Enable a firewall. <br> <br>Check out the Security Hardening section of <a href=“”>Automated Provisioning of DigitalOcean Cloud Servers with Salt Cloud on Ubuntu 12.04</a>