• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Best settings for Apache config file?

Garindan

New Pleskian
Sorry, I have this posted in Plesk 11 forum too but no one would reply in there...

I recently set up my first vitual dedicated server with Plesk 11.

The apache server seems to have had a few problems and has gone down a few times. I've looked into the apache settings etc but have never done it before, so am hoping for some clarification on what to do and which settings might be best for the server?

Firstly, is '/etc/httpd/conf/httpd.conf' the correct file for the apache settings? Some sites I have read suggest a path that is using the domain name such as '/var/www/vhosts/example.com/conf/httpd.include', I'm confused.

The settings in /etc/httpd/conf/httpd.conf are...

Timeout 60
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 5
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 4000
</IfModule>

<IfModule worker.c>
StartServers 1
MaxClients 50
MinSpareThreads 1
MaxSpareThreads 4
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

The server is very modest at this stage - CentOS 6.2, 40Gb storage, 1Gb Ram, Intel Xeon CPU L5609 @ 1.87GHz. It is showing as using 60% of the memory.

The server only gets about 50 hits a day? It's quite small traffic wise.

I'm new to Plesk etc so any help with recommended settings and clarification on how to add a vhosts file would be very welcome

Many thanks for any help!
 
/etc/httpd/conf/httpd.conf is the global configuration file and is where you would normally make changes that you want on a global level. So, for example, this is where you would adjust MaxClients and so on.

Apache going down could be caused by a number of things. What did /var/log/httpd/error_log say when it stopped?

Are you running out of memory?

If you run "top" you'll see how much memory each individual apache process takes. If you multiply this by MaxClients you'll get a figure for the maximum amount of memory apache could theoretically use if maxclients was reached. You may find that you are allowing apache to use more memory than is actually available, and depending on the VPS technology this may cause various types of problems.

The number of apache clients can be set surprisingly low. For example, on a system with 300+ busy sites, you can get away with as few as 20 MaxClients (but YMMV). It is a matter of tuning things to balance performance against amount of memory used.
 
Thankyou for your reply Faris! and sorry for not replying sooner. It's actually stopped happening and I can't be sure what time it happened last to check the error log. So I'll keep an eye on it and post the error log if it happens again.

Are these the standard Parallels apache settings? Should changes be made to the global httpd.conf file? Or shouldn't they be added to a new config file in /etc/httpd/conf.d?

Thanks for your help again!
 
I don't think Plesk messes with maxclients and similar settings in the main httpd.conf. This means the settings that are the default for httpd in your particular disro will be what you find in the conf file.

I woulld not make changes to maxclients etc via an additional fine in conf.d personally. I'd stick to httpd.conf
I've never had those settings overwritten (so far!) for any reason.
 
Thankyou for your help so far Faris. I have come back to this now as the site has been going down again, for 2 hours last night.

It seems any time there's an increase in traffic the site can't handle it. These were the errors from last night, they occurred over and over again...

Wed Feb 20 23:13:59 2013] [warn] [client 204.124.182.157] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://www.greenfingers.uk.com/forums/
[Wed Feb 20 23:13:59 2013] [error] [client 204.124.182.157] Premature end of script headers: index.php, referer: http://www.greenfingers.uk.com/forums/
[Wed Feb 20 23:45:44 2013] [warn] [client 112.123.168.95] mod_fcgid: can't apply process slot for /var/www/cgi-bin/cgi_wrapper/cgi_wrapper, referer: http://www.greenfingers.uk.com/forums/

During that time running 'top' showed the memory was maxed out.

I have tried reducing the number of MaxClients in httpd.conf to 20. I changed it on both prefork MPM and worker MPM, but the server is currently using prefork so am I right in thinking worker settings don't matter?

I have also set KeepAlive to On. When I first set up the server somewhere said to have it off, but I've since read to have it on?

I also read about the error and changed FcgidMaxProcesses to 5. I had also tried increasing it from the default 20, and also tried 10, but 5 seemed to work best and allowed the site to load again. Although I can't be sure it wasn't just a drop in traffic. I read some postings about FcgidBusyTimeout helping with this but my fcgid.conf doesn't have it. I wasn't sure whether to add it.

So.... I can't seem to find help with the best settings for this server :( Is a 1GB, 1.8Ghz server enough for one website with about 100 hits per day? I'm sure it must be?

I had looked at switching to worker MPM, but I'm using wordpress and the guide I read said other stuff needed to be installed to and it scared me a little :) I also wondered if FastCGI needed to be updated - it shows as psa-mod-fcgid-configurator 2.0.0-cos6.build110120606.19 in Plesk Components, is this the correct one or am i looking at the wrong thing?

Sorry for all the questions, I'm trying to learn but I can't find a good guide on the net.

Current settings....

fcgid.conf

FcgidIdleTimeout 40
FcgidProcessLifeTime 30
FcgidMaxProcesses 5
FcgidMaxProcessesPerClass 8
FcgidMinProcessesPerClass 0
FcgidConnectTimeout 30
FcgidIOTimeout 45
FcgidInitialEnv RAILS_ENV production
FcgidIdleScanInterval 10


httpd.conf

Timeout 60
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 5
ServerLimit 50
MaxClients 20
MaxRequestsPerChild 4000
</IfModule>

<IfModule worker.c>
StartServers 1
MaxClients 20
MinSpareThreads 1
MaxSpareThreads 4
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

Are there other things I can do such as disabling unneeded modules etc?
 
Last edited:
We are navigating in waters I'm not completely familiar with here, so I can only give you basic advice on these matters:

If this is a wordpress site, using a plugin such as W3 Total Cache, if you have not done so already, should probably be high on your to do list.

php_fastcgi is a serious memory/resource hog. It is more secure, and I would not run a wordpress site in mod_php mode, but the increased memory usage can be a problem. You will probably see it as a separate process in top alongside the httpd process.

I would look at reducing the FcgidMaxProcesses. Essentially, each process you allow will eat up more memory. However, I do not know how this interacts with MaxClients. For example, what happens if you have fewer FcgidMaxProcesses than MaxClients, and you have the maximum number of clients connected? I have no idea :)

KeepAlive is a double-edged sword. The problem is that there may be a request for data - say an image, and nothing more. But apache will keep the connection/process alive until the timeout value is reached, even though no data is being requested. Some experimentation with timeouts, keepalive on/off and maxclients may be needed.

I will say that on a busy server with multiple sites, keepalive is not always the best option, but on a server serving a single site, it can be useful.

1Gb for a single site with low traffic can seem like a huge amount of RAM to have available. But lots of things take a lot of memory in the background. Mysql is one. Experiment with mysqltuner (available via the ASL repo if need be) and you'll find it recommending you increase this that and the other. But those increases can cause masses of memory to be requested, which reduces the amount of memory available to other processes.

Certainly disabling unneeded modules is a good idea. You can reduce apache's footprint significantly by doing so. The question is which ones are safe to disable? python might be a good one to start with, along with mod_dav and related (but you need to do some of these in httpd.conf).

Enabling and configuring mod_deflate is another thing to think about. This actually increases the amount of memory used but does speed things along and may free a process up more quickly. Have a quick search from some how-tos on mod_deflate - there are a couple of different basic ways to enable it.

In terms of software updates, if the Plesk Updater tells you there are modules you need to update, then update them via the Updater. Otherwise leave well alone. (and make sure you don't accidentally upgrade to plesk 11 unless you actually want to).

Errr.....brain dump over. YMMV. Some of what I've said may be wrong, etc etc etc :)
 
Back
Top