Archive for October, 2008
Un-mapping a path from mod_jk in Apache
We have a few legacy servers at $work where they still use mod_jk and mod_jk2. Unfortunately for us one of these was setup by the client’s admins who did not like to configure tomcat context mappings within the virtual host that only needed them. This has the affect of sending many more URLs to tomcat/jboss than necessary.
One way to get around this when you cant change those mappings is to use the SetEnv module.
In the virtual host where you want to exclude certain paths from being mapped, add the following entries and reload the config.
# Disable global mod_jk mapping that break stats.
SetEnvIf Request_URL "/stats*" no-jk
SetEnvIf Request_URL "/awstats*" no-jk
PECL timezonedb fun
So we have a number of Red Hat based systems where clients use PHP on them. A few clients have requested we update the timezone information on them. Sure no problem.
However “pecl install timezonedb” fails with out of memory errors at 8mb, even though the php memory limit is 32mb or even 64mb on my own machine.
A dirty work around is to install it using
pecl bundle timezonedb
cd timezonedb
phpize
./configure
make
make install
You will need to ensure you have GCC, make, phpize (from php-devel package) installed though.
Currently I have not found a fix or any bugs filled in PECL bug tracker or the Red Hat bug tracker. This is reproducible on CentOS, which is to be expected.
I will update this post if I find a way to fix it or a bug ID in any of those trackers.
Update:
Make sure you have at least these packages installed.
autoconf
automake
libtool
bison
flex
Update 2:
pecl timezonedb will only work with php5 due to no date module existing in the php4 source.
This particular problem manifested because we have php4 and php5 installed on a single server, so clients can use either version as a CGI.
Office 2007 mime types in Apache (Linux)
So you have a client who needs to download/upload office 2007 docs via an Apache HTTP server on a Linux server?
You will probably need to add these directives to have the download work correctly. They can be added to an individual virtual host or the main configuration file:
AddType application/vnd.ms-word.document.macroEnabled.12 .docm
AddType application/vnd.openxmlformats .docx .pptx .xlsx
#AddType application/vnd.openxmlformats-officedocument.presentationml.presentation .pptx
#AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document .docx
AddType application/vnd.ms-word.template.macroEnabled.12 .dotm
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template .dotx
AddType application/vnd.ms-powerpoint.template.macroEnabled.12 .potm
AddType application/vnd.openxmlformats-officedocument.presentationml.template .potx
AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 .ppam
AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 .ppsm
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow .ppsx
AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 .pptm
AddType application/vnd.ms-excel.addin.macroEnabled.12 .xlam
AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 .xlsb
AddType application/vnd.ms-excel.sheet.macroEnabled.12 .xlsm
AddType application/vnd.ms-excel .xlt .xla
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template .xltx
AddType application/vnd.ms-excel.template.macroEnabled.12 .xltm
AddType application/vnd.ms-xpsdocument .xps
AddType application/application/vnd.ms-powerpoint .ppt .pot .pps .ppa
AddType application/msword .doc .dot
The commented lines are there incase the shorthand pptx and xlsx mimetype does not work.
dstat – one hell of an awsome performance monitoring tool
Dstat is a versatile replacement for vmstat, iostat, netstat, nfsstat and ifstat. Dstat overcomes some of their limitations and adds some extra features, more counters and flexibility. Dstat is handy for monitoring systems during performance tuning tests, benchmarks or troubleshooting.
Dstat allows you to view all of your system resources instantly, you can eg. compare disk usage in combination with interrupts from your IDE controller, or compare the network bandwidth numbers directly with the disk throughput (in the same interval).
This has to be my most favourite bit of software right about now. You can download it from http://dag.wieers.com/home-made/dstat/ or get it via your distros package manager.
It really helps you find the bottle neck in a system without having 10 terminals open.
Customer comment of the day
So one of the guys was on the phone to a client, something to do with a domain registration..
“Do they they turn off the Internet on weekends?”
Yes, clearly they do. No one uses the Internet on weekends, that is why we are closed on Saturday and Sundays.