-
Notifications
You must be signed in to change notification settings - Fork 86
FAQ: Installation: Apache Web Server
Summary Outlined below are a few of the Apache modules that help optimize your WordPress performance
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:
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
To begin using mod_deflate you have to specify which text-based file types should be compressed.
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 filename matches the .js, .html or .css files it will be compressed (collapsed ) through the quality Apache SetOutputFilter directive. You may include other file types 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 - 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 - By default, it's the advanced viable ideal of 15. high number means high compression level, again at the reward of more server resources.
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
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
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
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