Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
70 lines (49 sloc) 2.64 KB
group subgroup title menu_title menu_node menu_order level3_menu_node level3_subgroup functional_areas
Getting Started
What is a docroot?
What is a docroot?

The web server document root (often referred to as the docroot) is where you put all the files your website needs to function. You can use your web server's default docroot or [modify it to enhance security]({{ page.baseurl }}/install-gde/tutorials/change-docroot-to-pub.html). For example, you should restrict browser access to Magento-specific files after installation.

The path to your web server's default docroot varies depending on the following:

  • Operating system
  • Web server software
  • Hosting provider (if you use one)

{} As part of the Magento 2 installation process, you specify a subdirectory (usually magento2) under the docroot. The Magento-specific files are installed in this subdirectory, so knowing where to locate the default docroot is critical.

Contact your hosting provider

If you use one, contact your hosting provider to locate the web server docroot. For example, cPanel{:target="_blank"} typically uses public_html as its docroot, but you should contact your provider to confirm.

Find the docroot yourself

This section assumes you've already set up a simple web server using Apache virtual hosts{:target="_blank"} or nginx server blocks{:target="_blank"}.

{} You can use virtual hosts and server blocks to run more than one website on a single machine (e.g., and or override the web server's default docroot without changing it.

To find the docroot on your server:

  1. Open one of the following files in a text editor:

    • Ubuntu

      /etc/apache2/sites-available/000-default.conf (Apache)
      /etc/nginx/sites-available/default (nginx)
    • CentOS

       /etc/httpd/conf/httpd.conf (Apache)
       /etc/nginx/nginx.conf (nginx)
  2. Search the file for DocumentRoot or root.

    Typically, the default Apache docroot on Ubuntu and CentOS is /var/www/html whereas the default nginx docroot on CentOS is /usr/share/nginx/html. For example:

    • Apache + Ubuntu/CentOS

      DocumentRoot "/var/www/html"
    • nginx + CentOS

      root      /usr/share/nginx/html
You can’t perform that action at this time.