Categories Archives: Technical

Migrating from Rackspace Cloud to Cpanel

Fed up with cloud hosting? You’re not alone. Just recently, I assisted a mass exodus of over 50 mysql/joomla based sites. After the migration to just a modest dedicated server with Cpanel, MySQL queries improved by 200% on average. Some longer queries and page loading times saw improvement of over 1000%. Additionally, the dedicated server […]

Easy Javascript-based Bookmark Link

Here’s a simple Javascript-based bookmarking script for your site. It automatically populates the page name and URL so you don’t have to. Put this in the <HEAD>: <script language=”javascript” type=”text/javascript”> function addToFav() { if(window.sidebar){ window.sidebar.addPanel(document.title, this.location,””); }else{ window.external.AddFavorite(this.location,document.title); } } </script> Then, you can add a link in your <BODY>: Bookmark Us!

Sysctl and ip_conntrack_max optimization

On a busy webserver, you have to be very careful that you don’t run out of connection tracking buckets. Check how many you have set as your max: /sbin/sysctl net.ipv4.ip_conntrack_max Check how many you’re using: wc -l /proc/net/ip_conntrack A good maximum setting for most web servers with at least 2Gb RAM is 65536. Change the […]

Bash: How to add a line on top of text files with sed

Sometimes you might need to add one or more lines of text to the top of an existing text file. Let ‘sed’ rescue you: sed -i ‘1iSTUFF TO ADD’ file.txt You can add multiple lines (separated by \n) to multiple files at once: sed -i ‘1iSTUFF TO ADD\nMORE STUFF’ *.txt

Categories: Code, Linux, and Technical. Comments Off on Bash: How to add a line on top of text files with sed

Pre-analysis of a DDOS attack on a Cpanel or Linux server

Determine the nature of the attack (SYN, GET, ect): netstat -nat | awk ‘{print $6}’ | sort | uniq -c The following will list all the IPs connecting to the server in order of most connections. netstat -plan|grep :80|awk {‘print $5’}|cut -d: -f 1|sort|uniq -c|sort -nk 1 We can see which domains are most active […]

Tracking SPAM on a Cpanel Server

If you are using a cpanel/WHM server then the MTA will be Exim by default. Enable Mailheaders by running /scripts/easyapache script.  After that, check the mail header using: exim -Mvh <message id> From that you will able to find the source of spam.

Categories: Linux and Technical. Comments Off on Tracking SPAM on a Cpanel Server

Setting up Adaptec Storage Manager on a headless Ubuntu/Debian server

Adaptec RAID cards have huge performance gains over other cards, but the management features in Linux stink. Really bad. If you don’t have a GUI installed, you cannot set up monitoring or alerts, but thankfully you can use a Windows machine to set this up remotely. Additionally, there are no .deb packages so we have […]

Installing mod_limitipconn on a Cpanel server

Absolutely essential in a shared hosting environment. This example is relevant to Apache 2.2.x. ############# ## Compile mod_ipconnlimit cd /root wget http://dominia.org/djao/limit/mod_limitipconn-0.23.tar.bz2 tar xjf mod_limitipconn-0.23.tar.bz2 cd mod_limitipconn-0.23 /usr/local/apache/bin/apxs -cia mod_limitipconn.c ### this needs to be redone after each apache recompile ## in WHM, add to apache Pre VirtualHost Include (all versions) <IfModule mod_limitipconn.c> # Set […]