Archive for the tag 'Apache'

SBDavid

Apache Graceful Restart Process

Apache Graceful Restart Process

Signal: USR1

apachectl -k graceful

The USR1 or graceful signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they’re not serving anything). The parent re-reads its configuration files and re-opens its log files. As each child dies off the parent replaces it with a child from the new generation of the configuration, which begins serving new requests immediately.

This code is designed to always respect the process control directive of the MPMs, so the number of processes and threads available to serve clients will be maintained at the appropriate values throughout the restart process.

Apache Security Tips - Permissions on ServerRoot Directories

In typical operation, Apache is started by the root user, and it switches to the user defined by the User directive to serve hits. As is the case with any command that root executes, you must take care that it is protected from modification by non-root users. Not only must the files themselves be writeable only by root, but so must the directories, and parents of all directories. For example, if you choose to place ServerRoot in /usr/local/apache then it is suggested that you create that directory as root, with commands like these:

mkdir /usr/local/apache
cd /usr/local/apache
mkdir bin conf logs
chown 0 . bin conf logs
chgrp 0 . bin conf logs
chmod 755 . bin conf logs

It is assumed that /, /usr, and /usr/local are only modifiable by root. When you install the httpd executable, you should ensure that it is similarly protected:

cp httpd /usr/local/apache/bin
chown 0 /usr/local/apache/bin/httpd
chgrp 0 /usr/local/apache/bin/httpd
chmod 511 /usr/local/apache/bin/httpd

You can create an htdocs subdirectory which is modifiable by other users — since root never executes any files out of there, and shouldn’t be creating files in there.

Problems building Apache with your custom modules

If you have problems building Apache with your custom modules, and you are unable to troubleshoot the problem, run

/scripts/easyapache –skip-custom-optmods

This builds Apache and PHP without any custom modules.

From WHM

Access the WHM equivalent found in EasyApache’s Help section.

In order to remove a custom module from the server, simply delete the files you have created when you issued the above commands. The module will be removed from all future builds and the EasyApache interface.

Reference: http://cpanel.net/

SBDavid

Apache PHP Request Handling in Cpanel

Apache PHP Request Handling in Cpanel

Cpanel PHP’s main configuration file is located at /usr/local/apache/conf/php.conf
The php.conf file is called by the Apache configuration file (httpd.conf) by means of an include command.

WHM provides an interface that can assist you in configuring PHP. It is located in Service Configuration >> Apache Configuration >> PHP and SuExec Configuration. You are also able to access a command line interface that provides the same options through the following script:

/usr/local/cpanel/bin/rebuild_phpconf

Reference: http://cpanel.net

When the cron file /etc/cron.daily/1hup_apache_logs is executed the httpd service is not able to reload properly and it get stuck. The service is dead and it needs to be restarted manually. Even the server load goes high. And in some cases the server even crashes.

To Resolve this issue.

Change “reload” to “restart” in /etc/cron.daily/1hup_apache_logs

Content of /etc/cron.daily/1hup_apache_logs are as follows:

#!/bin/bash
#/etc/rc.d/init.d/httpd_app_init reload-grc
# XXX Fix of the “lost child came home” issue
! /sbin/chkconfig httpd || /etc/rc.d/init.d/httpd_app_init reload

And then change to

#!/bin/bash
#/etc/rc.d/init.d/httpd_app_init reload-grc
# XXX Fix of the “lost child came home” issue
! /sbin/chkconfig httpd || /etc/rc.d/init.d/httpd_app_init restart

Reference: http://parallels.com

« Prev - Next »