Q. I'd like to cache few static pages or files that are viewed frequently such as index.html or order.html and so on. How do I cache files under Apache with using proxy solution?
A. You need to use mod_file_cache which can cache frequently requested files that change very infrequently is a technique for reducing server load. mod_file_cache provides two techniques for caching frequently requested static files. These techniques reduce server load when processing requests for these files by doing part of the work (specifically, the file I/O) for serving the file when the server is started rather than during each request.
How do I configure mod_file_cache?
Open your httpd.conf file, enter:
# vi httpd.conf
To cache index.html and faqs.html, enter:
How do I cache all static files in a directory called /kb/?
Try the following code to get listing of all files:
# find /var/www/domain.com/kb/ -type f -print | sed -e 's/.*/mmapfile &/' > /etc/httpd/conf.d/mmap.conf
Now open httpd.conf file, using the Include directive:
Save and close the file. Restart httpd:
# service httpd restart
- mod_file_cache documentation.
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop