2

My apache2 installed on the debian8.1.
In the configuration file /etc/apache2/apache2.conf

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

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

There are lines in the index.html:

The default Debian document root is /var/www/html. You can make your own virtual hosts under /var/www. This is different to previous releases which provides better security out of the box.
With phpinfo() to get document root is /var/www.

How to change it into /var/www ?

3 Answers 3

4

They changed the location to /var/www/html in apache2.4 so that bit of text in the index.html is just letting you know of the change. You don't need to change the document root.

If you want to make a new virtual host just add a new_website.conf to the /etc/apache/sites-available and specify whatever location you want (to create the symlink in the sites-enabled folder use a2ensite). As a general rule making a new location under /var/www/html/new_website would be fine (or any other location you prefer that the apache user can access).

You shouldn't need to tamper with the apache2.conf for a normal website. Main change between apache 2.2 and apache 2.4 that seems to trip people up, is you need to ensure u use an extension of .conf to your new virtual host conf file. In earlier apache 2.2 it didnt matter.

1
  • I had already twice dealt with this update and again I spent a good time debugging a case with no .conf suffix for virtual host config... Thanks for mentioning it! Commented Jan 20, 2016 at 17:36
1

You need to edit the site specific config file at this path /etc/apache2/sites-enabled

the file you probably need to edit is 000-default.conf

just change the DocumentRoot from /var/www/html to /var/www/YOUR_DIRECTORY

0

For security' reasons, you should be create an alias in /var/www to /var/www/html but up to you. (I wouldn't do that)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.