How to change apache to do graceful restarts in DirectAdmin
To do that, you’ll need to change your httpd boot script.
The path for your script will vary depending on your OS.
For FreeBsd it’s:
/usr/local/etc/rc.d/httpd
For all other OS’s, it’s:
/etc/init.d/httpd
As for the actual change, you’ll edit the httpd boot script for your system, find this code:
restart)
stop
waitforexit “httpd” 20
start
;;
and change it to read:
restart)
kill -USR1 `cat $PIDFILE`
;;
An apache restart will no longer start apache if it’s stopped. You must “start” it, as the graceful restart only works on already running processes.
Source : http://directadmin.com
Rebuild Apache with Higher FD_SETSIZE
The default FD_SETSIZE for apache is 1024. This is a hardcoded value which sets the maximum amount of files that apache can open at any given time, including log files, CGI scripts, PHP includes, database connections, etc. It is hardcoded to prevent apache from using an insane amount of file descriptors and starving your system of resources. However, if you have a lot of domains on your server with their own transfer and error logs (500+ on standard RedHat, 250-300 on Plesk servers) then you may hit the 1024 limit and get all sorts of weirdness.
At worst apache will fail to start or will not serve any web pages if it does start.
What needs to be done is to install the apache source RPM, modify the sources and spec file, and rebuild the source RPM and binary RPMs with the modified FD_SETSIZE (4096 in this case).
For DirectAdmin
Edit /usr/include/bits/typesizes.h and /usr/include/linux/posix_types.h and set
#define __FD_SETSIZE 32768
And then recompile with customapache or custombuild.
Setting up the Linux terminal to use proxy servers
If you are running proxy at IP 192.168.1.1 with the proxy port as 3128 and wish to use wget, lynx and other utilities from a shell prompt then export the following variables on the command line.
export http_proxy=http://192.168.1.1:3128/
export ftp_proxy=http://192.168.1.1:3128/
export ftps_proxy=http://192.168.1.1:3128/
export https_proxy=http://192.168.1.1:3128/
Now your will be able to use the update commands from the command line.
Using perl to make custom changes to files
The below example shows how to make changes to the virtual host conf files. Here we are changing CustomeLog to #CustomLog.
perl -pi -e ’s/CustomLog/#CustomLog/’ virtual_host*.conf
Apache stops responding but is running
A few things that could cause that are:
Possible Causes:
1) MaxClients set to a value too low.
2) If you have over about 800 VirtualHost entries (domains, subdomain, ssl, etc.. ), the ErrorLog files open too many file descriptors and apache won’t be able to log the errors and may stop responding.
This number can vary per box depending on the limit, and setup of the system. (lower/higher)
Solutions:
1) edit /etc/httpd/conf/httpd.conf and increase the MaxClients setting to something like 200 or 300.
2)
cd /usr/local/directadmin/data/templates
cp virtual_host*.conf custom
cd custom
# remove all the ErrorLog lines (or comment them out) from the 4 virtual_host*.conf files that are in the custom directory.
Source: http://directadmin.com/