Ramblings from MostlyChris

Tech stuff and a bit more

Browsing Posts in Apache

mod_deflate allows apache to compress files and deliver them to browsers that can use compressed files. This saves on bandwidth and renders page loads faster. It's a fairly simple process to do this. You need to have write access to the apache config files and need to be able to create a new conf file. [...]

Installing APC

No comments

Follow these steps to install APC on a RHEL 5 server. 1. Install php-devel for phpize (if not installed). yum install php-devel 2. Install the apache devel pkgs for apxs (if needed). yum install httpd-devel 3. Make /tmp executable. mount -o remount,exec /tmp 4. Set the memory limit in /usr/share/pear/pearcmd.php to 16M. vi /usr/share/pear/pearcmd.php @ini_set('memory_limit', [...]

I recently ran across a request to place all vhost configurations in separate files. Here are the steps I followed to make this happen. Step 4 is only necessary if you have existing virtual hosts in the main or a single apache configuration file. 1. I created the virtual_sites directory under /etc/httpd/conf.d/ 2. I set [...]

This is a super simple site redirect. This, of course, can get much more complicated than what is shown here. Place this in the apache configuration file (non-Plesk boxen) or in a .htaccess file. Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] —– If you want to redirect a site using the httpd.conf file inside [...]

Use this little one liner to grab the number of hits from the apache access logs. DATE=`date +%d.%b.%Y`':';for i in `lsof -p $(ps faxwwwu|awk '$1 ~ /^root$/ && $11 ~ /httpd$/ {print $2|"head -1"}' )| awk '$9 ~ /access_log$/ {print $9| "sort -u"}'`; do echo "——-"$i"——"$DATE;awk '$4 ~ /^.'$DATE'/ {hit[substr($4,2,2)"\t"substr($4,14,2)"."substr($4,17,1)]++;ip[$1]++} END { for (i in [...]