Archive for the tag 'Apache'

SBDavid

Rebuild Apache with Higher FD_SETSIZE

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.

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/

Updating Apache to the latest version in DirectAdmin

If you wish to update your 1.3 version of apache to the most recent, run the following:

cd /usr/local/directadmin/customapache
./build clean
./build update
./build apache_mod_ssl

If you’re using apache 2.x, use “./build apache_2″ isntead of apache_mod_ssl.

This should update both the configure options and the version of apache to the most recent version. Once the update has completed, you’ll need to restart apache:

You can check the current version of apache by running

httpd -v

Restart Apache.

/sbin/service httpd restart

Source : http://directadmin.com/

SBDavid

Configuring Apache Server in plesk

Modify global setting for the Apache server in the main Apache configuration file:

/etc/httpd/conf/httpd.conf for RedHat-based systems;
/etc/apache2/apache2.conf (or a corresponding file from /etc/apache2/conf.d/ /etc/apache2/sites-enabled/) for Debian-based systems;
/etc/apache2/httpd.con (or /etc/apache2/vhosts.d/*) for SuSE;

Virtual Host Structure and Permissions

Vhost permissions should satisfy the following conditions:

Home directory should be readable by apache, psaadm and psaftp.
The user cannot change some catalogues of their directories.
Other users should not have access to the user’s home directory.

SBDavid

Protecting System Settings in Apache

Protecting System Settings in Apache

To run a really tight ship, you’ll want to stop users from setting up .htaccess files which can override security features you’ve configured. Here’s one way to do it.

In the server configuration.

AllowOverride None

This prevents the use of .htaccess files in all directories apart from those specifically enabled.

« Prev - Next »