13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 7 ■ WORKING WITH APACHEOnce you’ve run that test, just use apachectl start to start Apache with this config (then useapachectl stop to stop it again). Now let’s try some of the possible options you can use for testingalternative configs.■ Note In Debian/Ubuntu, you may find that you need to source the Apache environment variables before usingapache2 as shown in this recipe, or you’ll get error messages such as this:apache2: bad user name ${APACHE_RUN_USER}Do this with the following:. /etc/apache2/envvars1. Start Apache using an alternative DocumentRoot:apache2 -k start -c "DocumentRoot /var/www/html_debug/"The DocumentRoot processing directive specifies the directory that will beserved as the root of your web space. So, when starting Apache with theprevious command, if you then went to http://www.example.com, the pageserved would be /var/www/html_debug/index.html. This is useful if you’retesting alternative versions of your web site, because it avoids having to editthe DocumentRoot option.You can also use -c to set any other directive. Note that -c processes thedirective after reading the config files (so it will overwrite config file settings),whereas -C will process the directive before the config files. Use this if youwant to set something that will affect the rest of the config processing, such assetting a custom log file with the following:apache2 -k start -C "CustomLog /var/log/apache2/testlog"Bear in mind that later directives in the file may override directives set with -C,such as if the standard apache2.conf has a CustomLog directive set, for example.You may be better off using a separate config altogether, as in the nextsuggestion.2. Start Apache with an entirely different config file:apache2 -k start -f conf/httpd.conf.debugThis is useful if you’re changing a big stack of options at once (and so using -cwould be unwieldy) or testing something like SSL (see recipe 7-4).159Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!