Skip to content

FAQ: Installation: Apache Web Server

Frederick Townes edited this page Dec 18, 2018 · 2 revisions

Apache Configuration Guide

Summary Outlined below are a few of the Apache modules that help optimize your WordPress experience

mod_deflate

Determining if mod_deflate is already installed on your server

  • Execute the following command apachectl -t -D DUMP_MODULES |grep deflate

You should see deflate_module (overlapped ) if mod_deflate is installed and enabled. If you don't see this, follow these troubleshooting stages:

Implementation

Documented refers to CentOS 7

Ensure that the module file is installed. This file is part of the core httpd package.

By default, it is found in /etc/httpd/modules/mod_deflate.so.

Also, the web server should be able to ajar this file. For this purpose mod_deflate.so should have experience legible permissions such as 755. check if the module has been loaded. ajar the Apache base modules configuration file /etc/httpd/conf.modules.d/00-base.conf and ensure this line is present and not commented out:

LoadModule deflate_module modules/mod_deflate.so

Configuration

To commence using mod_deflate you have to appoint which file symbols should be compressed. On one hand, obvious matter formats can be greatly reduced in size by compression, and that's why it makes sense to register it to HTML, CSS, or JavaScript records. On the other hand, many transmissions formats such as Flash and graphics already have compression in them, and extra compression will be useless.

To configure mod_deflate, create a brand-new configuration file /etc/httpd/conf.d/mod_deflate.conf with the sample code:

/etc/httpd/conf.d/mod_deflate.conf
<filesMatch "\.(js|html|css)$">
    SetOutputFilter DEFLATE
</filesMatch>

The above code means that when a file matches the continuations .js, .html or .css it will be compressed (collapsed ) through the quality Apache SetOutputFilter directive. You may increase other akin matter file protractions found on your site such as .txt.

Note

You could place the above code in the main configuration file /etc/httpd/conf/httpd.conf. 

However, it is better to separate such specific configuration parts in a different file. 

Configuration Actions

  • DeflateCompressionLevel - the compression level to be registered . By default, this level is 9, the advanced level of compression. 1 is the least level of compression. high compression would make the tiny output at the reward of high server CPU usage.
  • DeflateMemLevel - the amount of memory zlib, the compressing library, can use. The default ideal is 9 which is also the advanced ideal. To reason precisely the allowed memory you should multiply the DeflateMemLevel ideal by 16K.
  • DeflateWindowSize - the compression window size. By default, it's the advanced viable ideal of 15. high number means high compression level, again at the reward of more server resources. In most cases, you can leave the above belief Synonyms/Hypernyms to their failures. However, if you suspect your server performance has worsened significantly after using mod_deflate, you configure lower belief Synonyms/Hypernyms in your configuration file /etc/httpd/conf.d/mod_deflate.conf like this:
DeflateCompressionLevel 1

The above will decrease the compression level which will result in making the records large. However, mod_deflate will use less CPU this path. Make convinced to restart Apache if you decide to enlist any such actions.

A pre-optimized mod_deflate configuration file is available in the ini directory and can be placed in the /etc/httpd/conf.d/ directory

mod_mime

An optimized sample configuration mod_mime configuration file is located in the ini directory mod_mime.conf

mod_mime is installed by default in all default Apache installations. So we won't go into great detail as we did with mod_deflate.

Place this file in /etc/httpd/conf.d/ and restart Apache to enable this in your Apache configuration

mod_rewrite

An optimized sample configuration file for mod_rewrite is available in the ini directory.

mod_rewrite is installed by default in all default Apache installations. So we won't go into great detail as we did with mod_deflate.

Place this file in /etc/httpd/conf.d/ and restart Apache to enable this in your Apache configuration

mod_expires / mod_headers

An optimized sample configuration file for mod_expires and optimized mod_headers is available in the ini directory.

mod_expires is installed by default in all Apache installations. Place this file in /etc/httpd/conf.d/ and restart Apache to enable this in your Apache configuration

There are a few options in the Performance Plugin you will need to set

  • Performance > Browser Cache > Enable the following cache control headers:
    • Enable Expires Header
    • Enable Set Cache-Control Header
    • Enable Set W3 Total Cache Header
    • Remove query strings from static resources
Clone this wiki locally