Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serve static files from archive

Is there a module for apache/nginx to serve static files from archive (zip, tgz, tbz …), so that if there is no file in specified location, then stated archive is asked for that file?

like image 906
tig Avatar asked Feb 20 '11 19:02

tig


Video Answer


1 Answers

I'm not aware of such a module.

If you write your own, I would recommend that you take a look ate the try_files directive http://wiki.nginx.org/HttpCoreModule#try_files and hand the request arguments off to a script, e.g. a php file (see on the wiki page the try_files line ending in: /index.php?q=$uri&$args;).

Performance: That way you do some security checks with php, sort out search engine bots and maybe even memcache some files after you have them unpacked, but that depends on your specific request statistics/patterns.

Some tools or pear packages might allow you to extract files to pipe (stdout) and avoid dumping to the filesystem or unpacking can happen in a ramdisk to speed things up. But again, the way to go depends on your files sizes in order to make something like that reliable.

like image 182
initall Avatar answered Nov 15 '22 22:11

initall