The web server document root (often referred to as the docroot) is the web server鈥檚 root directory; in other words, all pages it delivers are located in this directory and subdirectories of it. The path to your web server鈥檚 docroot depends on:
- What operating system you鈥檙e using
- The web server brand and version
- Your hosting provider (if you use one)
This guide can鈥檛 cover all the possibilities, but we鈥檒l help you get started figuring out where your docroot is. It鈥檚 important; your Magento 2 installation directory is a subdirectory of your web server鈥檚 docroot so if you don鈥檛 know where the docroot is, you鈥檒l have a lot of trouble doing anything with Magento.
Look at the following sections in the order presented to locate your docroot.
Contact your hosting provider
If you use one, contact your hosting provider to locate the web server docroot. For example, cPanel typically uses public_html
as its docroot but don鈥檛 believe us! Contact your provider directly.
Contact your network administrator
If you don鈥檛 use a hosting provider, you鈥檙e not technical, and you鈥檙e not that familiar with how things are set up, contact your network administrator.
Find the docroot yourself
This section is for technical people who don鈥檛 mind opening a command prompt and finding the docroot themselves.
This section assumes you have a simple web server setup with virtual hosts. An Apache virtual host refers to running more than one web site (such as company1.example.com
and company2.example.com
) on a single machine. A virtual host configuration can override the default docroot. For more information about virtual hosts, see Apache 2.2 or Apache 2.4 documentation.
To find the docroot:
- Find what operating system you鈥檙e using.
-
Find your web server version:
- Ubuntu:
apache2 -v
- CentOS:
httpd -v
- Ubuntu:
-
See one of the following sections:
Find the docroot for Apache 2.2
To find the docroot for Apache 2.2:
- Log in to your Magento server.
-
Open the following file in a text editor:
-
Ubuntu:
/etc/apache2/sites-available/default
-
CentOS:
/etc/httpd/httpd.conf
-
-
Search the file for
DocumentRoot
. A typical result follows:-
Ubuntu:
DocumentRoot /var/www
-
CentOS:
DocumentRoot /var/www/html
-
Find the docroot for Apache 2.4
This section applies to Apache 2.4 on Ubuntu only. If you installed Apache 2.4 on CentOS, consult the documentation provided with your version of Apache for more information.
To find the docroot for Apache 2.4:
- Log in to your Magento server.
-
Open the following file in a text editor:
/etc/apache2/sites-available/default/000-default.conf
-
Search the file for
DocumentRoot
. A typical result follows:DocumentRoot /var/www/html
Find us on