Do more with Apache via the Command Line!

Advertisements

The command line utility httpd (some debian based distros based use the apache command instead of the httpd command)160px-asf-logosvg is just used to stop/start/reload the Apache server daemon. But there is more to httpd than this. We present you with some command-line options that enable you to change and test your apache configuration without manually editing the httpd.conf file.Read on..

Start up Apache using an alternative DocumentRoot:

This is useful if you’re trying out alternative versions of your web site, as it avoids editing the DocumentRoot option. Using the -c (Small C) option will overwrite your apache configuration file, whereas -C (Capital C) option will process the directive before the config files thus preventing the config file getting over-written.

sudo httpd -k start -c DocumentRoot /var/www/html_debug/”

Start up Apache using an alternative config file:

sudo httpd -k start -f conf/new-config.conf

Start up Apache using an some particular new module / test module: This command can be used to test some particular module before incorporating them full time into the httpd config file. For this, say you are testing a module mod1 then your new module mod1 will load only if the module mod1 is defined in the config file as:

<IfDefine loadmodule>

LoadModule mod1

<IfDefine>

sudo httpd -D mod1

After you’re done with any of these, issuing the following commands will restart the apache webserver with your normal settings / httpd configuration:

sudo httpd -k stop; sudo apachectl start




February 3rd, 2009 Written by The Digitizor    

Free subscription: Subscribe RSS feed or get daily tips in your email
* Click confirmation link sent in email * Don't see the email? check spam folder

  Facebook 


Liked it? Share...   Digg It!   Submit to Del.icio.us   Submit to Reddit   Stumble   Submit to Identica   Slashdot It   Send to a friend via email


blog comments powered by Disqus