Using of mod_expires caching for improve Performance ?

What is mod_expires caching ?

Mod_expires caching is a powerful tool that can be used to improve the performance of your website. By caching static files, mod_expires can reduce the number of requests that need to be made to the server, which can lead to significant performance improvements.

When a user visits your website, their browser will first check to see if it has a cached copy of the static content. If the browser has a cached copy of the content, it will display the cached copy instead of downloading the content from the server. This can save a lot of time and bandwidth, especially for users who are visiting your website for the first time.

To use mod_expires caching, you need to:

  1. Enable the mod_expires module in Apache. You can do this by adding the following line to your Apache configuration file:
/opt/lampp/etc/httpd.conf

open “httpd.conf” file and add below code

LoadModule expires_module modules/mod_expires.so

Next go to below path and open httpd-vhosts.conf file

opt/lampp/etc/extra/httpd-vhosts.conf
<VirtualHost *:80>
        ServerAdmin contact@wizbrand.com
        DocumentRoot "/opt/lampp/htdocs/wizbrand/wz-account-admin-ms/public"
        ServerName wizbrand.com
		LoadModule expires_module modules/mod_expires.so
		ExpiresByType image/png "access plus 1 hour"
		ExpiresByType image/gif "access plus 1 hour"
		ExpiresByType image/jpeg "access plus 1 hour"
		ExpiresByType text/javascript "access plus 1 week"
		ExpiresByType text/css "access plus 1 month"
		ExpiresByType text/html "access plus 1 day"
        Redirect permanent / https://www.wizbrand.com/
		
		Alias /site-admin /opt/lampp/htdocs/wizbrand/wz-siteadmin-ms/public
		<Directory  "/opt/lampp/htdocs/wizbrand/wz-siteadmin-ms/public">
            Options Indexes FollowSymLinks
            AllowOverride All
            Allow from all
            Require all granted
        </Directory>
</VirtualHost>

Next restart the apache server

sudo /opt/lampp/lampp restart

These directives will tell Apache to cache PNG, GIF, JPEG, JavaScript, CSS, and HTML files for the specified amount of time.  By reducing the number of requests that need to be made to the server, mod_expires can help to improve the scalability of web applications. This means that web applications can handle more concurrent users without experiencing performance problems.

Thanks for learning 👍👍

Hi I am Amit Kumar Thakur Experienced as s Software Developer with a demonstrated history of working in the information technology and services industry. Skilled in HTML, CSS, Bootstrap4, PHP, Laravel-9 , REST API,FB API,Google API, Youtube Api, Bitbucket,Github,Linux and jQuery. Strong engineering professional focused in Computer/Information Technology Administration and Management. Currently my profile is to Software Developer, analyze the requirement, creating frame for web application, coding and maintenance.

Related Posts

Using of register_globals for improve PHP performance ?

disabling the register_globals option in PHP can improve performance. When register_globals is enabled, all variables from the HTTP request are automatically registered as global variables. This can…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x