Optimizing Apache Web Server
To increase the performance of your Apache web server, you can do the following:
- Switch off unnecessary Apache modules to decrease the server resource consumption.
- Run Apache with piped logs to host more websites on the server.
- Set up the Apache restart interval to decrease the number of Apache restarts.
- Choose the Apache restart type: graceful or normal.
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.
Note: 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:
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
access_ssl_log.processed. Web statistics is counted based on these
If it is needed to analyze HTTPS and HTTP traffic separately, use the following commands:
grep https access_log
grep http access_log
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.
When you change a website’s hosting settings, the changes take effect only after the Apache restart. You can choose between the Apache normal and graceful restart.
The normal restart immediately kills all Apache processes, which leads to a short downtime for all websites hosted on the server. The graceful restart instructs Apache to gradually replace the existing processes with new ones. This does not affect the websites and no downtime occurs.
To avoid downtime, Apache in Plesk uses the graceful restart by default. If the graceful restart does not work as expected, you can choose the Apache normal restart.
To choose the Apache normal restart:
- Go to Tools & Settings > Apache Web Server (under “General Settings”).
- Clear the “Apache graceful restart” checkbox and then click OK.