How To Optimize Your Web Server

  breadcrumb arrow   Rahul's Essays   breadcrumb arrow   How To Optimize Your Web Server

By Rahul Gladwin | August, 2011.

Improving Loading Time of your Server:

The loading time of your website is an important criteria for usability and higher SERPs. In this article, I'll explain three techniques which can help you dramatically decrease the loading time of your virtual dedicated server (VPS) or dedicated server.

While writing this article, I've made the following assumptions:

1. You server operating system is Linux 2.6.xx with full root access.

2. You're running Parallels Plesk Panel version 9.3.x and Parallels Power Panel Version 394.x.

3. Your Apache version is 2.2.x.

Note: Make sure that you *backup* all files before editing them. Editing these files incorrectly will render your web server unusable.

1. Enable Apache KeepAlive and Apache Module mod_expires:

First, you'll need to enable KeepAlive and Module mod_expires. KeepAlive is a process which maintains longer HTTP sessions over the same TCP connection. Module mod_expires is a way to cache static page elements like CSS files or Javascript on your client's computer. To do this, we'll need to edit the main Apache server configuration file - httpd.conf - located here: /etc/httpd/conf/httpd.conf

This can be easily done through the "File Manager" in the Parallels Power Panel. Locate and open the httpd.conf file and add these lines somewhere at the bottom of the file:

ExpiresActive On
ExpiresDefault "access plus 30 days"

<Directory /var/www/vhosts/yourdomain.com/httpdocs>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
ExpiresByType text/php "access plus 2 weeks"
ExpiresByType text/htm "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/ico "access plus 1 year"
ExpiresByType image/icon "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType application/x-shockwave-flash "access plus 1 year"
</Directory>

NOTE: Those values are actual expiry dates used on my server; you may wish to modify them to suit your needs. While your httpd.conf file is still open, scroll up a bit and change:

KeepAlive Off

to

KeepAlive On

Reboot your server and make sure that you confirm your website headers.

2. Use GZIP Compression by Enabling Apache Module mod_deflate:

GZIP is a way of compressing your webpage, hence, decreasing download time and improving loading speed. Apache module mod_deflate is used to compress static data before sending it over to the end user. Add these lines to the .htaccess file located in your root directory:

AddOutputFilterByType DEFLATE text/htm text/plain application/xml image/x-icon

<FilesMatch "\.(php|php4|ico|png|js|css|htm|gif|xml|txt|jpg|jpeg|swf)$">
SetOutputFilter DEFLATE
</FilesMatch>

3. Enable Cache-Control:

Caching is temporarily storing common or frequently used page elements in fast media like RAM or SRAM. Cache-Control not only improves website loading speed, but also decreases bandwidth consumption. Add these lines to the .htaccess file located in your root directory:

Header set Cache-Control "max-age=290304000, public"

It is important to reboot your server for these effects to take place. Note that all values in this article are actual numbers I use on my server. You may wish to modify them based upon your design requirements.

Additional Readings:

Science Articles

1. The Big Bang: Proof that the Universe is Expanding

Business Articles

1. Corporate Failure: The Enron Case

Personal Experience Articles

1. My Experience during the Iraqi Invasion of Kuwait
2. Why did I become a doctor?

Philosophy Articles

1. The Existence of Matter
2. What is Time?
3. Life in a Drop of Water
4. Why I Support Mercy Killing

Short Stories

1. Voices from Hell: My Experience in Mussoorie, India

Religious Articles

1. One Powerful Prayer written by an Anonymous Author

Internet/Technology Articles

1. How to Stop Feedback Form & Guestbook Spam
2. How To Optimize Your Web Server

Product Reviews:

1. Review of the HMT Janata Hindi Dial wrist watch
2. Review of eBoundhost VPS hosting
3. Review of Delta Roma Imperiale Fountain Pen

Miscellaneous Stuff

1. Body-Mass-Index, Waist-to-Height Ratio, Body Fat, Basal Metabolic Rate Calculator
2. Pictures of old Kuwaiti Dinars
3. My First Computer - Pentium with Windows 95
4. Why is it hard to find Christian husbands?
5. Video of American Robin feeding her chicks
6. Signs you're being married to for Green Card
7. Micron to Grit Conversion Calculator
8. Grit to Micron Conversion Calculator

Random Pages:

Corporate Failure: The Enron Case Body-Mass-Index, Waist-to-Height Ratio, Body Fat, Basal Metabolic Rate Calculator
Video of me playing Ludwig van Beethoven - "Moonlight Sonata" (1st Movement) Notes on Female Reproductive System
Notes on Development of the Breast Notes on Chlamydia
Notes on Lipid Mobilization and Catabolism Notes on Statistical Research Methods
Differentiation of the Face Notes on Digestion
Notes on Basic Gastrointestinal Physiology Inferential Statistics
How To Optimize Your Web Server What is an ELEK`s Test?
Why did I decide to become a doctor? Medical School Admissions Essay Video: Titanic Piano Theme: The Portrait
Corporate Failure: The Enron Case My Experience during the Iraqi Invasion of Kuwait
USMLE Blood Lab Values Regulation of Heart Rate by Autonomic Nervous System
Images of Antibodies Video of me playing Yanni`s "Nightingale"
Generalized vs Specialized Transduction Differentiation and Anatomy of a Blastocyst
Notes on Cell Components Notes on Nervous Tissue
Voices from Hell: My Experience in Mussoorie, India Video of Cardiology Examination in a Clinical Setting

Please Do Not Reproduce This Page

This page is written by Rahul Gladwin. Please do not duplicate the contents of this page in whole or part, in any form, without prior written permission.