mywebsite.com shows index of / after installing Magento

mywebsite.com shows index of / after installing Magento

September 30, 2026 · Illustrated author avatarBy Stefan Bogdanescu
mywebsite.com shows index of / after installing Magento

Solving the “Index of /” Issue After Installing Magento

If you’re facing an “Index of /” error after installing Magento on your Apache server running Ubuntu, you’re not alone. This issue is quite common but easily resolvable with a few configuration tweaks. Let’s troubleshoot this problem step by step.

Understanding the “Index of /” Error

When you see the “Index of /” page instead of your website, it means that the Apache server is displaying a directory listing because it cannot find an index file (index.html) in the root folder of your domain. This can happen due to incorrect directory permissions or misconfigured virtual hosts.

Checking Your Server Configuration

First, let’s review your current configuration files to identify any potential issues. You’re already on the right track by sharing both your apache2.conf and mywebsite.com.conf files.

Reviewing /etc/apache2/sites-available/mywebsite.com.conf

In your virtual host file for mywebsite.com, you have correctly set the DocumentRoot to /var/www/mywebsite.com/html. This tells Apache where to look for the website’s files. However, there are a couple of adjustments we need to make:

  1. Remove the <Directory /> block above the <Directory /var/www/mywebsite.com/html/> section.
  2. Change Options Indexes FollowSymLinks Multiviews to Options FollowSymLinks.

The modified version looks like this:

<VirtualHost *:80>

    ServerAdmin info@mywebsite.info
    DocumentRoot /var/www/mywebsite.com/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/mywebsite.com/html/>

        Options FollowSymLinks
        AllowOverride All
        Require all granted

    </Directory>

</VirtualHost>

Reviewing /etc/apache2/apache2.conf

In your main Apache configuration file, you have the root directory set to deny all access. This is a good security practice but can cause issues with virtual hosts.

To resolve this, comment out or remove these lines:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

Reviewing /etc/apache2/sites-available/000-default.conf

Your default virtual host is already correctly configured to point to the root HTML directory (/var/www/html). Leave this file untouched.

Verifying Your File Permissions and Ownership

Before proceeding, let’s ensure that your Magento installation files have the correct permissions. Run these commands:

sudo chown -R www-data:www-data /var/www/mywebsite.com/html

This command changes the ownership of the html directory to the Apache user (www-data).

Next, verify the file permissions using:

ls -la /var/www/mywebsite.com/html

The output should look similar to this (with examples):

drwxr-xr-x 2 www-data www-data 4096 May 15 17:30 .
drwxrwxrwx 4 root   root    4096 Jan  1  1970 ..
-rw-r--r-- 1 www-data www-data 658 May 15 17:29 index.php
-rw-r--r-- 1 www-data www-data 307 May 15 17:30 .htaccess

Enabling Your Virtual Host and Reloading Apache

With the configuration adjustments complete, enable your custom virtual host:

sudo a2ensite mywebsite.com.conf

Then, reload or restart the Apache service to apply the changes:

sudo systemctl reload apache2

or for a full restart,

sudo systemctl restart apache2

Verifying Your Magento Installation

Finally, open your web browser and navigate to http://mywebsite.com. You should now see your Magento website instead of the “Index of /” page. If you still encounter issues, double-check that there are no typos or missing files in your document root directory.

Remember, proper directory permissions, virtual host configuration, and file ownership are crucial for a secure and stable Apache server running Magento.

If you found this solution helpful, please share it with your fellow developers! For more detailed guides on Magento development and server management, visit LaravelCompany.com. Happy coding!

Indexing Security Admin Configuration

Our network