Apache | Basic Apache Configuration | Server Location Directory (ServerRoot)
This article explains how to configure the server location directory, ServerRoot, in Apache.
ServerRoot directive
ServerRoot is the directory where Apache is installed.
ServerRoot directory
Search for ServerRoot in the httpd.conf file, and you should find content like the following.
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used. If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
Define SRVROOT "c:/Apache24"
ServerRoot "${SRVROOT}"
The directory is assigned to a variable named SRVROOT and then used by ServerRoot. The default is c:/Apache24. To change it, specify a new directory. Be careful not to add / at the end.
When Apache settings use relative paths rather than absolute paths, they are interpreted relative to the directory specified by ServerRoot. For example, look at the ErrorLog setting.
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error.log"
When written as a relative path like this and ServerRoot is c:/Apache24, the actual file path is c:/Apache24/logs/error.log.