Optimizing Apache Web Server

To increase the performance of your Apache web server, you can do the following:

Next in this section:

Switching On and Off Apache Modules

Running Apache with Piped Logs

Setting Up the Apache Restart Interval

 

Switching On and Off Apache Modules

You can switch off the Apache web server modules that are not critical to hosting services in Tools & Settings > Apache Web Server. This will allow you to reduce server resources consumption (for example, get the smaller RAM footprint that is critical to VPS) and, as a result, provide for more hosting customers on a server.

Note that some modules are interdependent and can be switched off (on) only when the modules they depend on are off (on). For example, the cache module depends on disk_cache, file_cache, and mem_cache modules. This means that you cannot switch off the cache until its three dependent modules are off.

Caution: This feature is for advanced users only. Toggle modules only if you completely understand the consequences of your actions. Note that some modifications may reduce Apache performance or even lead to it becoming inoperable. In addition, these changes may affect certain Plesk functions. For example, if you turn off mod_perl or mod_php, the Perl and PHP scripts (including webmail) will stop working on websites. This may cause a situation in which you offer a feature that does not work in a service plan.

Depending on your operating system, the following Apache modules are always enabled:

Debian or Ubuntu:

Redhat or CentOS:

 

Running Apache with Piped Logs

If you are going to host more than 300 domains or web sites on your server, we recommend that you switch on the support for piped logs in the Apache web server. By default, Apache restarts when it needs to process log files, for example, rotate them. When the number of websites on your server is about 300 or more, this will slow down the server because of frequent Apache restarts. If you switch on the support for piped logs, Apache will write error and access logs through a pipe to another process instead of direct writing to log files. This lets Apache work without restarting every time it processes the logs.

You can switch on the support for piped logs using the Tools & Settings > Apache Web Server > Piped Logs option.

Note: If you host more than 256 websites on your server, the limit value in the nginx configuration will be adjusted automatically.

When you use this option, both HTTP and HTTPS traffic is logged to the access_log file. Daily Maintenance task analyzes it and creates two ".processed" files: access_log.processed and access_ssl_log.processed. Web statistics is counted based on these files.

If it is needed to analyze HTTPS and HTTP traffic separately, use the following commands:

grep https access_log

grep http access_log

 

Setting Up the Apache Restart Interval

When users perform operations with domains and subdomains (such as creating, removing, or changing their configurations), the changes take effect only after the restart of Apache.

If you want to avoid too many Apache restarts, you can set a fixed interval of time in which Plesk should restart Apache. Note that if the interval is 0 seconds, Apache restarts immediately after each change. It is recommended to always set this interval to more than 0 seconds, especially if users perform a lot of operations with domains and subdomains through Plesk.

If during the specified interval of time no changes were made with domains, Apache will not restart.