Archive for the tag 'Apache'

SBDavid

Stopping and Restarting Apache

Stopping and Restarting Apache

In order to stop or restart Apache, you must send a signal to the running httpd processes. There are two ways to send the signals. First, you can use the unix kill command to directly send signals to the processes. You will notice many httpd executables running on your system, but you should not send signals to any of them except the parent, whose pid is in the PidFile. That is to say you shouldn’t ever need to send signals to any process except the parent. There are three signals that you can send the parent: TERM, HUP, and USR1, which will be described in a moment.

To send a signal to the parent you should issue a command such as:

kill -TERM `cat /usr/local/apache2/logs/httpd.pid`

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).

apachectl -k graceful

Sending the HUP or restart signal to the parent causes it to kill off its children like in TERM, but the parent doesn’t exit. It re-reads its configuration files, and re-opens any log files. Then it spawns a new set of children and continues serving hits.

Signal: HUP

apachectl -k restart

Note: Before doing a restart, you can check the syntax of the configuration files with the -t command line argument.

SBDavid

How to disable SSL2.0 in apache

To disable the SSL2.0 protocol and forcing 3.0

For apache 1.3, find the line:

#SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

and change it to:

SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:!SSLv2:+EXP:+eNULL

Note the 2 changes: a) remove the # character at the beginning of the line, and b) change +SSLv2 to !SSLv2

For apache 2.x, do the same thing, but instead it will be in the /etc/httpd/conf/ssl.conf file, or for the new apache system, /etc/httpd/conf/extra/httpd-ssl.conf (if you have both files, just change it in both).

Source : http://directadmin.com/

Try removing –with-openssl from your configure.php file and recompile php.

cd /usr/local/directadmin/customapache

vi configure.php

#remove –with-openssl from the file, save, exit.

./build clean
./build php n

How to track which site is using the apache processes.

For apache 1.3, edit your /etc/httpd/conf/httpd.conf and add

ExtendedStatus On
<Location /httpd-status>
SetHandler server-status
</Location>

just after the code that says “ServerSignature On”. Save, exit, then restart apache. You can access the stats page by going to http://192.168.1.1/httpd-status where 192.168.1.1 is your server’s IP.

If you’re running apache 2.x with custombuild, then it’s already in the file:

/etc/httpd/conf/extra/httpd-info.conf

Change the “Allow from” lines to include your IP, or remove the line completely to allow from all.

Source : http://directadmin.com/

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

« Prev - Next »