Question

Web server security CHECKLIST

  • Posted on November 24, 2014
  • OrbitalAsked by Orbital

Good day! Is there any checklist? Here is mine as beginner.

OS Linux:

  • SSH and SFTP logins only
  • add SSH key
  • deactivate root
  • serverpilot.io they give you firewall and updates. As I know updates for mySQL and PHP with their settings. This firewall allows TCP ports 22 (ssh), 80 (HTTP), and 443 (HTTPS) as well as UDP port 68 (DHCP)
  • fail2ban with conf (permanent bans)
  • htop for monitoring (CPU, RAM, etc)
  • DO Snapshot or Dropbox for auto backups
  • something else?

How to secure mySQL, PHP, Apache, maybe NGINX?

Good advices and links are welcome.


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.

For MySQL security, it’s as easy as running this:

mysql_secure_installation

I’d also recommend a MySQL dump nightly, like this:

/root/scripts/mysql_backup.sh

#!/bin/bash
USER='backup_user'
PASS='PASSWORD'
### MAKE SURE TO ADD THE TRAILING SLASH ###
DIR='/path/to/backup/to/'
date=`date +"%m-%d-%Y %T"`
if [ ! -d "$DIR" ]; then
   mkdir -p $DIR
fi
mysqldump -u $USER -p"$PASSWORD" --all-databases --master-data |gzip -1 > ${DIR}mysqlbackup_$date.sql.gz
#### You can then add a script to offload to S3/DropBox/e-mail if you like. ####

cron to run:

00 04 * * * /root/scripts/mysql_backup.sh

Thanks,

More a question than a contribution to the checklist, but is choosing a different port for ssh a good security measure? Something else than the default 22 ?

Thank you JonsJava. Some more good programs:

  • Traffic: iptraf
  • Monitor network traffic: jnettop
  • For mysql: mytop