So you've bought a CentOS VPS from us and you find that sometimes you run out of memory and things go wrong.
We've got a few tips and tricks for you to help keep your VPS ticking over.
Adjusting the number of web based clients your VPS can handle from 1 second to the other.
1. First you should backup the file with the following command
cp /etc/httpd/conf.d/swtune.conf /etc/httpd/conf.d/swtune.backup.`date +%F-%H-%M`
2. The following command opens swtune.conf
vi /etc/httpd/conf.d/swtune.conf (this command requires that you have some knowledge of using vi, the command nano may be easier to use)
you should see the following section marked "prefork MPM".
Note: The file on a Debian VPS is located at /etc/apache2/apache2.conf
3. Edit the section that reads:
StartServers 2
MinSpareServers 1
MaxSpareServers 5
MaxClients 10
MaxRequestsPerChild 1000
to something more like this (changes marked in bold):
* For VPS Stater:
StartServers 1
MinSpareServers 1
MaxSpareServers 3
MaxClients 50
MaxRequestsPerChild 1000
4. Save this file by first hitting the Esc key and then typing :wq [hit enter]
5. Restart apache
/etc/init.d/httpd restart [hit enter]
The timeout settings in Apache can sometimes cause problems and keep your visitors waiting for content.
1. First you should backup the file with the following command
cp /etc/httpd/conf.d/swtune.conf /etc/httpd/conf.d/swtune.backup.`date +%F-%H-%M` [hit enter]
2. The following command opens swtune.conf
vi /etc/httpd/conf.d/swtune.conf [hit enter] [this command requires that you have some knowledge of using vi, the command nano may be easier to use)
3. Use the following keystrokes to find "Timeout"
/Timeout [hit enter]
4. Edit the section that reads:
Timeout 120
to a more reasonable value like the following (changes marked in bold):
Timeout 20
5. Save this file
6. Restart Apache to apply the changes:
/etc/init.d/httpd restart [hit enter]
A note from the author:
To find out if the MaxClients setting is causing you grief, it's easiest to login to your VPS and run:
grep -i maxclient /var/log/httpd/error_log
This command should give you some details if this setting has been reached.