A problem that I’ve been asked to fix several times now is a slow Apache server. In several of these cases the slowness was caused because of the size of the logs. Most servers are set up to rotate the logs, but everynow and then things can go awry and the rotation stops. On a busy server you can find the logs growing over 500MB over the course of a couple of weeks. Once they get to this size it will generally start to slow Apache down as it has to open and write to that logfile.
I’ve seen logfiles that had grown to greater than 1GB and Apache really starts to strain at that point.
So… don’t forget to check the logs in /etc/httpd/logs (and /etc/httpd/domlogs if you have CPanel accounts). If the logfiles aren;t rotaing then logrotate is your friend (and youshould get acquainted with it right now).
Popularity: unranked [?]
Posted by Gary |
No Comments »
I spent a bit of time searching for an answer to this and found it in a couple of places. Here are the required step to get clamscan installed on Centos 5.
1. Download the rpmforge package
wget http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
2. import the rpmforge GPG key
rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
3. Check that you have a valid RPM file
rpm -K rpmforge-release-0.3.6-1.el5.rf.*.rpm
4. Install rpmforge
rpm -i rpmforge-release-0.3.6-1.el5.rf.*.rpm
5. Install yum priorities
yum install yum-priorities
Yum-priorities allows you to add a priority parameter to each of the repositories listed in /etc/yum.repos.d. You need to do this to ensure that the base repositories always take precedence over the rpmforge repository.
6. Edit each of the .repo files in /etc/yum.repos.d adding a priority line to each repository like this:
[base]
name=CentOS-$releasever – Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1
Give all of the repositories a priority of 1 except the repositories in the rpmforge.repo file – they should have a priority of 2
7. Install clamav (alter the filename if you have a 64 bit server)
yum install clamav.i386
8. Install the clamd daemon (you need this for freshclam which updates the virus database
yum install clamav.i386
9. Configure the clamd daemon to start at reboot
chkconfig clamd on
10. Start the clamd daemon
service clamd start
Run freshclam to update the database
Popularity: unranked [?]
Posted by Gary |
No Comments »
I was recently moving a site from one WHM/CPanel server to another WHM/CPanel server and found that this error was causing some problems. This was particularly interesting as I remember trying to move a CPanel account in the past (using /scripts/pkgacct) and we found that everything was fine except that none of the database tables had been backed up. On that occassion we were able to just recreate the empty tables as there wasn’t a whole lot of data but we never did get to the root cause of the problem.
This recent move was similar. It was actually a site that hosts around 2100 blogs with the Wordpress WPMU version. Given that there were a lot of blogs with a lot of data, failure wasn’t an option so I decided to do a manual dump of the database. That’s when I saw the error from mysqldump. A quick Google of the error message turned up a similar issue and it wasn’t until after I read carefully that I found this person had the solution. It was in a bug report though and not all that descriptive so I thought it was worth blogging.
The cause of the problem is the default limit that MySQL has on open files. If you fire up your favourite SSH client and login to your server and issue the command:
mysqladmin variables
…it’s going to tell you this:
open_files_limit | 1024
So, we now know that MySQL has a default limit of 1024 open files. That’s a lot of files…in most cases… but consider my situation where I have over 2000 blogs and each blog has multiple files. Even with 1 file per blog we’d be over that limit. Note that this issue should only happen with MyISAM databases as they use separate files for each table. Knowing that this open files limit was the issue my next step was to find out exactly how many files were in the database directory. To do that you can issue a command like:
ls /var/lib/mysql/my_database/ | wc -l
The /var/lib/mysql part is the default directory for MySQL MyISAM files and the my_database part would be the directory that is named the same as the database you are trying to back up. The command line above will list (ls) the files in the directory and the pipe to ‘wc -l’ will count how many words are displayed in the resulting ‘ls’ listing. In my case the number was:
60061
That’s a heck of a lot of files! The fix was to edit /etc/my.cnf and add the following line to the [mysqld] section:
open-files-limit=100000
I then restarted the MySQL server and it completed the backup of the database and all of its tables.
Popularity: 3% [?]
Posted by Gary |
No Comments »
I’m sure you’ve seen web sites that carry various ‘trust’ logos. Trust is important when you expect the public to enter their personal information on your website. It may well be that you are entirely trustworthy and dedicated to the protection of your customers information, but is that the first perception they get when they land on your website?
Website and business certification services have been around since the 1990’s. The main difficulty with most services has been the high cost. Most small businesses can’t afford several thousand dollars per year. There have been (and probably still are) a handful of cheaper services around but you generally get what you pay for and some of the cheaper services are a bit dubious. They only provide very basic verification checks and for that reason they aren’t particularly trustworthy.
Trust-Guard provide business verification, PCI compliance/security scanning and other verification services at a fraction of the cost of most similar services. Their verification methods are second to none and include verification of your businesses website URL, business address, support phone number, support email address, managing member address (kept private), managing member phone number (kept private) and managing member email address (kept private). All of these aspects of your business are checked and verified, not by simply looking up online records but by actual contact being made to each of these contact points. Trust-Guard are just as diligent with PCI compliance, security scanning and privacy policy compliance.
The best part is that the cost for these very professional services ranges from $47-$87 per month. Business and website certification can significantly increase your website sales and with such a low cost there is no excuse to be missing out on sales due to a poor perception of the trustworthiness of your web site.
Full details and pricing are available at The Trust-Guard Website.
Popularity: 11% [?]
Posted by Gary |
No Comments »
A few times now I’ve had to update a file in multiple home directories. I did a lot of searching and using tips and examples from several sites, plus the little bit of experience I had with shell scripts (hey, I may be a geek but I’m not a bash geek!
), I wrote this little script. It looks through all the home directories for a specific file, updates it with a new version and then changes the permissions to the correct owner for that home directory. Cool eh?
In this case I was updating wordpress’s rss.php file for a bunch of hosting accounts. Here’s the script:
========== 8< ========================
#!/bin/sh
# These next 3 lines should be on a single line.
for file in $(find /home -name "rss.php" |
grep 'wp-includes/rss.php' | xargs ls -l |
grep 'rss.php' | awk '{print $9}')
# Followed by this line and the rest of the script
do
owner=$(ls -al $file | awk '{print $3}');
mv $file ${file}.bak.php
cp /updates/new_wp_rss.php $file
chown $owner $file
chgrp $owner $file
echo "Changed owner to $owner for $file"
done
=================== >8 ================
The script backs up the existing file and copies a new one from the /updates directory. It then changes the ownership on the new file so that it is correct for the home directory that it is currently in. I also have it print that out to screen … that’s just a bit of paranoia – I like to see what’s happening
.
You may be wondering about the second ‘grep’ on the first line of the script. It’s in there because I use this script fairly regularly and in some cases I had a mix of old and new files. I only wanted to update the old files, so I was grepping the size of the file in that second grep. Instead of grep ‘rss.php’ it was something like grep’15347′ so that it would find all of the files named in the first grep, but only update them if they were a specific size.
Popularity: 11% [?]
Posted by Gary |
No Comments »