Skip to content

Instantly share code, notes, and snippets.

@zachbrowne
Created April 6, 2012 17:13
Show Gist options
  • Save zachbrowne/2321426 to your computer and use it in GitHub Desktop.
Save zachbrowne/2321426 to your computer and use it in GitHub Desktop.
Bash script that secures Apache2 with mod_evasive / mod_security & installs Google Pagespeed.
#!/bin/bash
################################################################
# Harden & Optimize Apache for Ubuntu 11.10 64bit Web Server #
# by Zach Browne - http://zachbrowne.com #
################################################################
# Update system
aptitude update && aptitude -y safe-upgrade
# Install mod_security & mod_evasive.
aptitude -y install libapache2-mod-evasive libapache-mod-security php5-suhosin
apt-get -f install
# Install PageSpeed Apache2 module.
#wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_i386.deb # Uncomment if your server is 32bit
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_amd64.deb # Uncomment if your server is 64bit
dpkg -i mod-pagespeed-*.deb
apt-get -f install
#rm mod-pagespeed-beta_current_amd64.deb
rm mod-pagespeed-beta_current_i386.deb
# Restart Apache2
service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment