Apache2 | http.conf How do I set AllowOverride All on a directory

1

I have to set AllowOveride to All on my web server, but in my httpd.conf file, there is no <Directory> tag for me to place it in.

I never seen this before. What can I do? Where is the file I have to change?

I am on a LAMP server, and Debian7, with Apache2.

Thanks!

Félix Desjardins

Posted 2015-06-15T11:10:34.487

Reputation: 125

Answers

1

The file that you are looking for is probably in /etc/apache2/sites-enabled/000-default.conf or similar.

You can create the Directory tags yourself in /etc/httpd.conf, /etc/apache2/sites-enabled/000-default.conf, or in a new file placed in /etc/apache2/sites-enabled/example.conf

Below is what you need to include in one of the files mentioned above:

<Directory /path/to/directory-name>
AllowOverride All
</Directory>

Apache will load this directory block from any of the configuration files. I imagine that you are probably used to putting this in the default block that had previously been located in the /etc/apache2/httpd.conf file. The default DocumentRoot and Directory tags still exist but are probably located in /etc/apache2/sites-available/000-default.conf.

You may also consider creating a new configuration file for your specific website in /etc/apache2/sites-available/example.conf. Then placing within that file, something like this:

<VirtualHost *:80>
ServerName site-name.com
ServerAlias other-name.com www.site-name.com
DocumentRoot /path/to/application
    <Directory />
        AllowOverride All
    </Directory>
</VirtualHost>

By default Apache will load configuration from any file that is located in /etc/apache2/sites-enabled/* that ends in .conf

Jacob Margason

Posted 2015-06-15T11:10:34.487

Reputation: 490

At least on debian there is command a2ensite which will make the symlink from sites-available to sites-enabled for you (but you can make it also manually). – Marki555 – 2015-06-18T19:43:52.187

Thanks for your answer. Only one thing that I noticed. The 000-default file should have an .conf extension, right? – Félix Desjardins – 2015-06-18T19:58:52.620

yes, if you look inside httpd.conf you will see that near the bottom, there is: Include sites-enabled/*.conf You could ofc change that so that any file will be loaded in. You can also manually include any file: Include /path/to/file – Jacob Margason – 2015-06-19T16:02:57.253