How to increase the number of sites that can be hosted on a Parallels Plesk Panel for Linux server
There are going to be more than 300 sites on a Linux box running with Parallels Plesk Panel. Are there any prerequisites that have to be met?
By default, the Apache server allows the hosting of no more than 300 websites on a single box. This is due to a limitation on the number of files that can be opened by the Apache process at one time, which is usually 1,024. Apache needs to open 2-4 log files for each site hosted on the server, and once it reaches the opened-file limit, it crashes.
- The best practice for this case is to recompile Apache with an increased number of allowed file descriptors, as per our Knowledge Base article:260 How to recompile Apache, PHP, and IMAP with increased value of file descriptors larger than FD_SETSIZE (1024) on a RedHat-like system
- In case you do not want to recompile the Apache package, you may enable the Piped Logs feature, which allows you to have up to 900 sites on one server. More details can be found here:2066 How do I enable Piped Logs for Apache Web Server?
- Alternatively, you may use the trick below in order to increase the maximum number of allowed open file descriptors:Add ulimit -n 65536 at the beginning of the Apache init script, like this:Then restart Apache:12345678910111213# head -13 /etc/init.d/apache2#!/bin/sh### BEGIN INIT INFO# Provides: apache2# Required-Start: $local_fs $remote_fs $network $syslog $named# Required-Stop: $local_fs $remote_fs $network $syslog $named# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# X-Interactive: true# Short-Description: Start/stop apache2 web server ### END INIT INFOset -eulimit -n 65536Note: The file name and content may be different on your system. Another example:12# /etc/init.d/apache2 restartRestart Apache:12345678910111213141516# head -16 /etc/init.d/httpd#!/bin/bash## httpd Startup script for the Apache HTTP Server## chkconfig: - 85 15# description: Apache is a World Wide Web server. It is used to serve# HTML files and CGI.# processname: httpd# config: /etc/httpd/conf/httpd.conf# config: /etc/sysconfig/httpd# pidfile: /var/run/httpd.pid# Source function library.. /etc/rc.d/init.d/functionsulimit -n 6553612# /etc/init.d/httpd restart
As of the release of Parallels Plesk Panel 11.0 Nginx can be installed as a reverse proxy server in front of Apache. It will help you run more sites on one server.
Such a combination of Nginx and Apache provides the following advantages:
- The maximum allowed number of concurrent connections to a website increases.
- The consumption of server CPU and memory resources decreases.
- The maximum effect will be achieved for websites with a large amount of static content (like photo galleries, video streaming sites, and so on).Efficiency of serving visitors with a slow connection speed (GPRS, EDGE, 3G, and so on) improves. For example, a client with a 10 KB/s connection requests a PHP script, which generates a 100 KB response. If there is no Nginx installed on the server, the response is delivered by Apache. During these 10 seconds required to deliver the response, Apache and PHP continue to consume full system resources for this open connection. If Nginx is installed, Apache forwards the response to Nginx (the Nginx-to-Apache connection is very fast as both of them are located on the same server) and releases system resources. As Nginx has a lower memory footprint, the overall load on the system decreases. If you have a large number of such slow connections, using Nginx will significantly improve website performance.
See the Parallels Plesk Panel 11 Administrator’s guide for more details.
P.s. From KB