mod_expires – This module controls the setting of the Expires HTTP header in server responses. The expiration date can set to be relative to either the time the source file was last modified, or to the time of the client access.
The Expires HTTP header is an instruction to the client about the document’s validity and persistence. If cached, the document may be fetched from the cache rather than from the source until this time has passed. After that, the cache copy is considered “expired” and invalid, and a new copy must be obtained from the source.
mod_expires is included in most default installs.
Check wheter LoadModule expires_module modules/mod_expires.so is enabled or not in httpd.conf, if its not then uncomment it removing the # prefix.
And then add following code into your httpd.conf configuration file -
# enable expirations
ExpiresActive on
# expire images after a month in the client’s cache
ExpiresByType image/jpg “access plus 60 days”
ExpiresByType image/png “access plus 60 days”
ExpiresByType image/gif “access plus 60 days”
ExpiresByType image/jpeg “access plus 60 days”
# css may change sometimes
ExpiresByType text/css “access plus 1 days”
# special MIME type for icons
ExpiresByType image/x-icon “access plus 360 days”
</IfModule>
Restart apache server.
Resource links -
http://blog.cherouvim.com/mod_expires-and-cache-killers/
http://httpd.apache.org/docs/1.3/mod/mod_expires.html
http://www.david-guerrero.com/papers/squid/squid.htm
http://linuxreviews.org/webdesign/602_Apache_mod_expire/
http://jeremy.zawodny.com/blog/archives/009272.html
Share or Bookmark This Post With :
If Apache 2.0 is running on several Linux boxes behind a load balancer, here are a couple of things you can do to speed things up.
1. Disable RedirectMatch directives temporarily
2. Increase MaxClients and ServerLimit
This is a well-known Apache performance optimization tip. Its effect is to increase the number of httpd processes available to service the HTTP requests.
The 2 entries in httpd.conf, in IfModule prefork.c section are:
MaxClients 1000
ServerLimit 1000
Now there is a procedure for tuning the number of httpd processes on a given box:
1. Start small, with the default MaxClients (150).
2. If Apache seems sluggish, start increasing both MaxClients and ServerLimit; restart httpd every time you do this.
3. Monitor the number of httpd processes; you can use something like:
ps -def | grep httpd | grep -v grep | wc -l
If the number of httpd processes becomes equal to the MaxClients limit you specified in httpd.conf, check your CPU and memory (via top or vmstat). If the system is not yet overloaded, go to step 2. If the system is overloaded, it’s time to put another server in the server farm behind the load balancer.
WARNING: MaxClients of 1000 exceeds ServerLimit value of 256 servers, lowering MaxClients to 256. To increase, please see the ServerLimit directive.
To avoid above warning, You need to put the Serverlimit option before the maxclient in the apache config file.
Example config:
IfModule prefork.c
StartServers 20
MinSpareServers 5
MaxSpareServers 20
ServerLimit 1024 <====—— moved this line here rather than after the
Maxclients (otherwise Apache will gives error, “WARNING: MaxClients of 1000
exceeds ServerLimit value of 256 servers, lowering MaxClients to 256. To
increase, please see the ServerLimit directive”)
MaxClients 512 <====——– changed from 256 to 512
MaxRequestsPerChild 10000
IfModule
Share or Bookmark This Post With :
Apache 2.x is designed to balance flexibility, performance and portability. Apache is a good all-purpose webserver. Since Apache is designed to fit most scenarios it hasn’t been optimized to set any kind of speed records, but Apache 2.x is capable of high performance.
There have been many improvements made in Apache 2.x and many are enabled by default. But, there are some changes you can make at compile-time and run-time that can positively affect performance.
Share or Bookmark This Post With :
- Roundcube – Free browser-based IMAP client
- mtop – MySQL terminal based query monitor
- Kohana – Swift, Secure, and Small PHP 5 Fram...
- FormMail – free form processing PHP script
- Xataface – The fastest way to build a front-...
- dotProject – the Open Source Project Managem...
- The jQuery Form Plugin
- DocVerse has officially been acquired by Google
- HDGraph – a free tool for Windows to draw mu...
- RandomClass jQuery Plugin
- Send emails using PHPMailer an...
- Firefox Addons Essential for S...
- Free SEO Tools From SEOMoz.org...
- URL Rewriting for PHP Web Appl...
- Multiple Instances of Tomcat w...
- Apache 2.x + Tomcat 4.x + Load...
- Pagination in JSP/Java
- PHP – Mysql Open Source ...
- java.lang.OutOfMemoryError: Ja...
- HOW TO Subversion+Apache on Fe...




