WebSphere Admin Toolkit : apachectl command

Everyone likes tweaks and hacks but the most important thing is that that feature is already present and we just don’t about it or don’t know how to use it.  In part2 of out AdminToolkit, you’ll learn how to use apachectl of IBM http server / Apache as a power user.

apachectl is a front end to the Apache HyperText Transfer Protocol (HTTP) server. It is designed to help the administrator control the functioning of the Apache httpd The apachectl script can operate in two modes. First, it can act as a simple front-end to the httpd command that simply sets any necessary environment variables and then invokes httpd, passing through any command line arguments. Second, apachectl can act as a SysV init script, taking simple one-word arguments like startrestart, and stop, and translating them into appropriate signals to httpd.

  • 1. Know what modules are loaded

# ./apachectl -l
this will display all the modules that are compiled into your installation of IHS/Apache

  • 2. Syntax issues

This happens to everyone. You make some changes to your config file and restarts IHS/Apache but it fails with error message syntax error. you can use apachectl -t to test your config file before restarting your IHS/Apache, to know if the config file has correct syntax.

# apachectl -t -f conf/httpd.conf_joseph
Syntax OK

  • 3. Have ever been asked to change DocumentRoot temporary ?

you can do it without restarting your server… using

# ./apachectl start -c "DocumentRoot /var/new/html" The above command starts your server with /var/new/html as docroot.  
  • 4. change loglevel temporary ?

It is possible to change the LogLevel temporary. the below command sets the loglevel to DEBUG temporarily.

apachectl start -e debug

  • 5. Startup errors

If you are getting error whilel starting your server and wants to log the startup errors to separate file  ..use

# ./apachectl start -E file_name

  • 6. What version of the server you are using?

# ./apachectl -v

  • 7. Know where can you use httpd.conf directives

This command will display all the httpd.conf directives and the places where they are valid. For a specific directive, it tells all the possible values and where it can be used inside the httpd.conf.

# ./apachectl -L

  • 8. Testing your changes.

The best practise is to make a backup of the httpd.conf file and then edit it . The other idea is to take a backup, edit the backup file, test your changes and then make the changes to the original. Now i have two config files httpd.conf [orginal] and httpd.conf_joseph [with new changes/configs]. Before i stop my IHS/Apache, i want to make sure that, my new httpd.conf will run with out erros.

This can be achieved by using “apachectl -f “
# ./apachectl -f conf/httpd.conf_joseph 

The above command specify an alternate ServerConfigFile. After running the above command, try ‘ps -ef|grep httpd’ .. you should see httpd.conf_joseph as argument to httpd.

here is what you do :
cd APACHE/bin

  • cp httpd.conf httpd.conf_joseph
  • Make your changes in httpd.conf_joseph
  • apachectl -f conf/httpd.conf_joseph
  • ps -ef|grep httpd
  • your changes are good 
  • cp httpd.conf_joseph httpd.conf
  • apachectl restart

2 thoughts on “WebSphere Admin Toolkit : apachectl command

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s