Help - Search - Members - Calendar
Full Version: Apache+Plesk problem (apache fails)
The Planet Forums > Control Panels > Plesk
mBf
Greetings,

My server is RH9 with Plesk6 installed.

I have /etc/httpd/conf/httpd.conf file where it includes other around 1000 configuration files in the form of /home/httpd/vhosts/XXX/conf/httpd.conf where xxx is a hosted domain name.

My problem is that apache fails to restart due to the large number of included files. Apache does not complaign and no errors were logged, it simply "httpd failed" with no debugging info.

I have tried increasing the limit on open files in /etc/sysctl.conf and by adding "ulimit -n xxx" in both /etc/init.d/httpd and /usr/sbin/httpd with no luck (it worked at first, but after adding other domains using plesk, apache failed again.

I also tried recompiling apache after increasing the file descriptors in /usr/include/bits/typesizes.h with no luck.

Any help would be appreciated.

Cheers,

--mBf
Gravity
you are going to get the message Exceeded max file descriptors
if you go over 1024. On every plesk machine we have it does this. Searching google does not seem to help much, it is not one simple command, at least that did not do the trick for us.

I did post this problem a while back on both EV1 forums and Plesk forums. Neither rendered a solution.
mBf
QUOTE
Originally posted by Gravity
you are going to get the message Exceeded max file descriptors
if you go over 1024. On every plesk machine we have it does this. Searching google does not seem to help much, it is not one simple command, at least that did not do the trick for us.

I did post this problem a while back on both EV1 forums and Plesk forums. Neither rendered a solution.


Then what did you do to resolve the problem or at least as a workaround?
Gravity
Well first of all it was a client on one of the servers creating a whole bunch of subdomains. I deleted them and put a limit of 25 on his account... That solved our problem.

I really don't see this problem happening with 1024 domains on a small server.
If you have over 1000 domains on a server... It's time for a new server; and if you managed to put 1000+ domains on a server you will have no problem affording another one.

Nevertheless, when I looked at the problem apache would not start because of the max file descriptors exceeding 1024. But it is not the loading of multiple sub domains that cause this, it is the 1000+ log files being opened.
If you take out logging in the httpd.include files you will see apache will load up.
BUT, plesk will put this information back in if you edit the domains again. If you use plesk to make changes to domain config, you will need to take out the logs line again because it will generate it by default.

Hope this helps.
mBf
QUOTE
Originally posted by Gravity
Nevertheless, when I looked at the problem apache would not start because of the max file descriptors exceeding 1024. But it is not the loading of multiple sub domains that cause this, it is the 1000+ log files being opened.
If you take out logging in the httpd.include files you will see apache will load up.
BUT, plesk will put this information back in if you edit the domains again. If you use plesk to make changes to domain config, you will need to take out the logs line again because it will generate it by default.


I host around 600 domain, apache won't start really because of the 2 log files associated with every domain. I tried earlier removing the log lines from httpd.include, but yes, as you commented, plesk undo all the changes.

There absolutely no documentations about plesk that tell you how to reconfigure httpd.include within plesk. Except that it tells you to include another vhost.conf within every domain directory, nothing is advised.

Even removing the logs is not a solution, it's a temporary workaround. And even that workaround seems hard to find how.

Any ideas about the main apache problem, or how to configure plesk in such a way that it configures httpd.include files according to my specifications, are much appreciated.

Cheers,

--mBf
Gravity
You could try to turn off logging for each of the domains, or at least ones that do not matter. If you turn off logging in plesk it should write that to the plesk database, then when it regenerates files it might not include the log lines.

All else fails you need to make the temp workaround permanent with a simple script to replace the files with your modified ones =| Until you can really figure out how to increase the max file descriptors.
But don’t take my word for it; I think you need to recompile the kern to do that. You will need to make the changes you need and recompile your current kern so it takes effect.

Ps. I don't have a test base to work with, let us know how it works out. I am VERY interested in solving this problem as well.
mBf
In the moment of writeing, my httpd is running ok with 1532 file descriptors openned. I have removed some domains that begins with www as well as other domains that have problems (disabled by client, etc..).
I dont know really. I suspect that it's not a file descriptor problem that make apache fails. However, let's suppose this is the problem and make the following notes..

- when starting apache with low ulimit (i.e, ulimit -n 1024), it fails immediately.

- when starting apache, after raising the file descriptors limit to 4192 for an instance, it reads all the configuration files already (you can make sure by issuing "lsof -p | wc -l"), then startup script hangs for around five minute, then it fails.

- I tested that on a recompiled vanillia kernel (2.4.27) and a recompiled apache with high file descriptors set (#define __FD_SETSIZE 32768) in /usr/include/bits/typesizes.h and /usr/include/bits/types.h and /usr/include/linux/posix_types.h

- I have raised file-max to 131072 in /etc/sysctl.conf (also sysctl -w fs.file-max=131072). It has no better effect on the problem.

I really want to solve this problem as yet I have not found any solutions for it on any official website nor any other forums.

Cheers,

--mBf
mBf
Ok, let's make all the domains logs into one big file instead of separate two logs (access_log and error_log) for each domain.

We know that plesk overwrite domain configuration files (/etc/httpd/vhosts//conf/httpd.include) with settings it has in plesk database.

We can include more settings for the domain by including a vhost.conf file in /etc/httpd/vhosts//conf/. Plesk automatically insert a "Include conf/vhost.conf" in httpd.include when that file exists.

That would make the main problem even worse by including one more file for apache to read.

I tried disable statistics in plesk control panel for all the domains but that only remove "alias /webstat /statistics/access_log" from /etc/httpd/vhosts//conf/httpd.include. We want to remove "CustomLog /statistics/access_log combined" and "ErrorLog /statistics/error_log" instead.

I tried playing in plesk database as well as /usr/local/psa directory, looking for any clues about customizing /etc/httpd/vhosts//conf/httpd.include with no use. Maybe the customizations reside in the encoded php pages of plesk, I dont know. Needless to mention that there are absolutely no documentations that plesk offer about the subject.

Cheers,

--mBf
mBf
I have managed to get rid of the custom log and error log from /home/httpd/vhosts//conf/httpd.include by writing this shell script.

CODE
#!/bin/bash

# vhost.sh

# written by mBf



OLDTAG1="CustomLog"

NEWTAG1="#CustomLog"

OLDTAG2="ErrorLog"

NEWTAG2="#ErrorLog"

for FILE in /home/httpd/vhosts/*

do

       sed -e "s/$OLDTAG1/$NEWTAG1/g" -e "s/$OLDTAG2/$NEWTAG2/g" "$FILE/conf/httpd.include" > temp

       mv -f temp "$FILE/conf/httpd.include"

done

exit 0


After making this shell script a cron job running every 15 minutes, apache is running as a charm now.

Cheers,

mBf
Gravity
What does it say in your logs is the error?
We are still trying to figure out this problem. We got max file descriptors, yet ulimit shows unlimited on the machine for some reason.
mBf
QUOTE
Originally posted by Gravity
What does it say in your logs is the error?


Actually it fails with no errors, neither in logs nor on stdout.
I do NOT get the error "exceeded max descriptors".

--mBf
Ronny
ulimit -n 32768


Try that number.
Little Frog
ALSO posted in this thread so any subscribers / searchers can see this post here as well as original posts I made.

After much research and ending up here reading your thread.. i was quite depressed.

Plesk says they can have a Red Hat Enterprise 3 Default configuration run up to 2000 domains on a server with 4 gigs ram. Well i have that default config along with 2 gigs ram on a dual xeon server... mirror raid array of 200 gig drives.

I am only able to run 650 domains before apache crashes with a segmentation fault... well USE TO...

Scott at EV1 has solved my problems.

See what happened was I added about 200 domains to my server and ran into the same issue with Too Many Files open so i changed my limits EVERYWHERE....
Recompiled PHP
Recompiled IMAP
Recompiled Apache (httpd)

Also had to change my MaxClients in the config file cuse I was maxing out on that to I set it to this.

CODE
########################################

# APACHE SERVER/MAXCLIENT SETTINGS

########################################

ServerLimit 1000



<IfModule prefork.c>

       StartServers            10

       MinSpareServers         10

       MaxSpareServers         80

       MaxClients              1000

       MaxRequestsPerChild     40

</IfModule>



<IfModule worker.c>

       StartServers            2

       MaxClients              600

       MinSpareThreads         25      

       MaxSpareThreads         75

       ThreadsPerChild         25

       MaxRequestsPerChild     10

       # Turned off to use less memory

       # HTTPD memory usage went from 29M to 26M per pid

       ThreadGuardArea off

</IfModule>



# Research this

#ListenBacklog

########################################


The ServerLimit is the important one to note becuase if you don't have that you can only go up to 250 MaxClients before HTTPD will start caughing errors on restart.

So then we were able to go to about 650 standard hosted domains before HTTPD on restart would just say Starting [Failed] - how annoying

Upon doing
CODE
service httpd graceful
then it would tell me the segmentation fault error.

A special tech got on the server and we started debugging and found that one of the additional packages that needs to be recompiled is OpenSSL

So if you are having any of these errors

"Too Many Files Open" - Apache Error Log
"Segmentation Fault" - service httpd graceful (restarting / starting apache)
or problems with Horde and similar problems

==
Errors:

[root@server home]# tail -f /var/log/httpd/error_log
[Wed Nov 03 17:52:43 2004] [warn] RSA server certificate CommonName (CN) `plesk' does NOT match server name!?
[Wed Nov 03 17:52:43 2004] [notice] Digest: generating secret for digest authentication ...
[Wed Nov 03 17:52:43 2004] [notice] Digest: done
[Wed Nov 03 17:52:44 2004] [notice] Apache configured -- resuming normal operations
[Wed Nov 03 17:54:54 2004] [notice] child pid 7210 exit signal Segmentation fault (11)
[Wed Nov 03 17:55:59 2004] [notice] child pid 7207 exit signal Segmentation fault (11)
==

And so on and so on

Follow these updates from SW-SOFT
Read both before performing recompile

Recompiling PHP & IMAP
http://faq.sw-soft.com/index.php?ToDo=view...Id=173&catId=40

Recompiling Apache
http://faq.sw-soft.com/index.php?ToDo=view...Id=134&catId=29

Once you have done these 2 doing OpenSSL functions the same way.

A good resource to find the packages for your architecture is www.rpmfind.net

The OpenSSL package to get and recompile is (as of 3.23.2005)
openssl-0.9.7a-33.12.src.rpm

Red Hat ES: ftp://rpmfind.net/linux/redhat/updates/en...a-33.12.src.rpm

I was told by tech at EV1 that for my system it had to be openssl-0.9.7a-33.12.src.rpm or newer. For older versions of Red Hat I am not sure.

I hope this helps you guys.

If it does drop me a line at ian@littlefroginnovations.com
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.