To find the document root of an Apache web server, you can look for the DocumentRoot
directive in the Apache configuration file.
The Apache configuration file is typically located at /etc/httpd/conf/httpd.conf
on Red Hat-based systems, or /etc/apache2/httpd.conf
on Debian-based systems.
To find the DocumentRoot
directive, you can use the grep
command to search for the directive in the configuration file. For example:
grep DocumentRoot /etc/httpd/conf/httpd.conf
This will display the DocumentRoot
directive and its value in the configuration file. The value of the DocumentRoot
directive specifies the directory where the Apache web server looks for the documents to serve.
You can also use the httpd
command with the -V
option to display the Apache version and compiled-in default settings, including the DocumentRoot
directive. For example:
httpd -V
This will display the Apache version and compiled-in default settings, including the DocumentRoot
directive and its value.
You can find more information about the grep
and httpd
commands and their options in the grep
and httpd
documentation or by running the grep --help
and httpd --help
commands.