Where to add AllowOverride inside 000-default.conf

Hey Craig, I’m on a dedicated VPS that I set up, running Ubuntu 18 and have not yet installed Magento on this VPS because I am only part-way through chapter 2 of your How to install Magento 2.3 and build a web server instructions.

I noticed that your video differs slightly from Magento’s instructions as to where within /etc/apache2/sites-available/000-default.conf to paste

<Directory "/var/www/html">
    AllowOverride All
 </Directory>

Your video shows/instructs to add it to the very, very end of the file, whereas Magento’s official instructions states to add it directly before “</VirtualHost>”. Does it make a difference if we follow the video or Magento’s official instructions?

Hi @d_dog and welcome.

Good eye with the documentation. So, technically there are a number of places that you can add those aforementioned lines within the 000-default.conf file. You can:

  1. Add it inside of the <VirtualHost *:80> container to specify changes to port 80 only
  2. Add is inside of the <VirtualHost *:443> container to specify changes to port 443 only
  3. Place it outside of the containers (e.g. end of file) to specify changes to all ports

If you want to get even more technical about it, then there is an argument to be made that we should even be touching the 000-default.conf file - But instead creating a new Virtual Hosts file specifically for the /var/www/ directory. But that goes way beyond the topic of Magento.

But to answer your question, the reason for my placement in the video is based on 2 main factors:

  • It’s easier to reference the end of the file for a total beginner
  • It shouldn’t make any difference for the purpose of the tutorial
1 Like

Thank you for the excellent response.