Serving Microsoft Office 2007 Documents From Apache
Ξ September 11th, 2009 | → 0 Comments | ∇ Ubuntu |
This raised it’s ugly head as I was trying to link to an existing .xlsx file from an Apache site hosted on Ubuntu Server that I had set up for someone.
All worked fine and dandy from Firefox 3 under Jaunty, but and Windows clients were trying to open the file with their default .zip client – despite seeing the file as a .xlsx.
As it happens, this is the correct default behaviour – as a .xlsx file is meant to be an archived XML file anyway. Despite the correctness of the situation though, it wasn’t too handy for all the Windows user in the office.
The simplest answer lay in updating the Mime types in Apache;
You could update the /conf/mime.types in the Apache installation – however, this would be overwritten should you later update Apache. The answer then, is to update your httpd.conf or, if you’re doing this on a per-directory basis, using the .htaccess file.
The entry that you’ll need for .xlsx is ;
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
If you want the full set of Mime types for Office 2007, then here you go ;
AddType application/onenote onetoc onetoc2 onetmp onepkg
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.template.macroEnabled.12 xltm
AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
AddType application/vnd.ms-powerpoint.slide.macroEnabled.12 sldm
AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm
AddType application/vnd.ms-word.document.macroEnabled.12 docm
AddType application/vnd.ms-word.template.macroEnabled.12 dotm
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application/vnd.openxmlformats-officedocument.presentationml.slide sldx
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx






