Debian – Apache2 | http.conf How to set AllowOverride All on a directory

apache-http-serverdebiandebian-wheezyhttpd

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!

Best Answer

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