ApacheAdmin

Apache HTTP Server LifeCycle control

1.1.1     Starting Apache at System boot up

Usually this is a need when there is a emergency reboot happen to a Pre-Production or Live environments then whenever system restores its basic requirements

$ cp /etc/httpd/run/httpd /etc/rc.d/init.d

when you copied the httpd file in the /etc/rc.d/init.d path and it will automatically starts apache when server rebooted

1.1.2     Shutdown Apache HTTP Server

In order to stop or restart Apache, you must send a signal to the running httpd processes. here 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 four signals that you can send the parent: TERM, USR1, HUP, and WINCH, which will be described in a moment.

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

kill -TERM `cat /etc/httpd/logs/httpd.pid`

The second method of signaling the httpd processes is to use the -k command line options: stop, restart, graceful and graceful-stop, as described below. These are arguments to the httpd binary, but we recommend that you send them using the apachectl control script, which will pass them through to httpd.

1.1.3     Stopping – Apache HTTP server

This is simple to say apache control to stop the http server. That will stop the Apache web server and all its corresponding child threads

apachectl -k stop

 

 

1.1.4     Graceful Restart

 not much about this option is the combination of graceful stop and start combined value we can get this.

apachectl -k graceful

1.1.5     Restart Now

Usually this command can be more useful when you are working on Apache web server configuration. There we need the restarts very frequently to check the server settings.

apachectl -k restart

1.1.6     Graceful Stop

This option of stopping http servers, this will stop the child threads unless until the client requests were processed. The applications uses transactions or sessions then the best practice would be using this graceful-stop option.

apachectl -k graceful-stop

Apache HTTP Server Administrator 

The Apache HTTP server runs more than 55% of e-commerce sites on the Internet and also on intranet applications, it is the Worlds top one free Web server, and more widely used than all other Web server combined. 

 

After release of Apache 2.0 came into more demand since its inception, and represents a complete change in Apache architecture, IT companies started looking for that administrators and dedicated developers learn new procedures and techniques for configuring and maintaining the Apache web server. Whole world of IT working with new ways of collaboration, contributing and openness, that improves innovative ideas.

Apache Administrator must have hands-on experiance on the following tasks: 

Apache Administration interview questions

1. How many types of Virtual host can be configured?

 There are two basic types of virtual hosts available for Apache HTTP server

There are sub categories allowed as

2. What is the different between static module and dynamic module?

The Apache HTTP Server is a modular program where the administrator can choose the functionality to include in the server by selecting a set of modules. Modules will be compiled as Dynamic Shared Objects (DSOs) that exist separately from the main httpd binary file. DSO modules may be compiled at the time the server is built, or they may be compiled and added at a later time using the Apache Extension Tool (apxs). Alternatively, the modules can be statically compiled into the httpd binary when the server is built. loading individual Apache httpd modules is based on a module named mod_so which must be statically compiled into the Apache httpd core. It is the only module besides core which cannot be put into a DSO itself. Practically all other distributed Apache httpd modules will then be placed into a DSO. After a module is compiled into a DSO named mod_foo.so you can use mod_so's LoadModule directive in your httpd.conf file to load this module at server startup or restart.

Reference site:

http://httpd.apache.org/docs/current/dso.html

 

3. What is MPM module? What MPM does? Why MPM?

 Basically Apache HTTP server can be operated with two modules.

      a) PREFORK

      b) MPM

   

 PREFORK module creates a new process for each request.

Here MPM is multi-processor module is that which accepts the requests and assigned the task to child process to handle them..

Choosing the right MPM (Multi processing modules):

 The worker MPM uses multiple child processes with many threads each. Each thread handles one connection at a time. Worker generally is a good choice for high-traffic servers because it has a smaller memory footprint than the prefork MPM.

The event MPM is threaded like the Worker MPM, but is designed to allow more requests to be served simultaneously by passing off some processing work to supporting threads, freeing up the main threads to work on new requests.

The prefork MPM uses multiple child processes with one thread each. Each process handles one connection at a time. On many systems, prefork is comparable in speed to worker, but it uses more memory. Prefork's threadless design has advantages over worker in some situations: it can be used with non-thread-safe third-party modules, and it is easier to debug on platforms with poor thread debugging support.

MaxClients, for prefork MPM

MaxClients sets a limit on the number of simultaneous connections/requests that will be served. this directive is a critical factor to a well-functioning server. Set this number too low and resources will go to waste. Set this number too high and an influx of connections will bring the server to a stand still. Set this number just right and your server will fully utilize the available resources. An approximation of this number should be derived by dividing the amount of system memory (physical RAM) available by the maximum size of an apache/httpd process; with a generous amount spared for all other processes.

 

As per initial analysis on both Worker MPM and legacy Prefork MPM modules sorted into a table with advantages and disadvantages in rows:

 

4. What need to configured to apache where restart of server not required?

 Not really sure on this question, I think any change made in the configuration file requires restart to changes to take effect

 

5. How to start a SSL enabled Apache web server?

The command same as regular webserver command  only, that is  apachectl. The difference is command line argument passed as  startssl

$ apachectl startssl

 

6. How to enable SSL on Apache web server configuration?

    The following configuration directives need to be set

SSLEngine ON

SSLOptions +StrictRequire

 

Inputs from Sumanth Naishadam, Sarangapani Matoori