3

I just set up the apache2/mysql server to play around with. But I found the something different than what I saw before. The root directory is pointed to /var/www/html/. I checked the /etc/apache2/apache2.conf file ,and says

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

This says the root directory points to /var/www/. Is this a bug ? And I also want to know why they made /var/www/html instead of /var/www/.

1
  • It doesn't say what you think it does.
    – user9517
    Aug 31, 2014 at 6:02

3 Answers 3

6

Usually the default configuration (eg. /var/www/html) is defined in /etc/apache2/sites-enabled and is overriding what's in your apache2.conf. This is normal behaviour, and it's common practice to add your vhost config as separate files in /etc/apache2/sites-available then symlink the enabled ones to /etc/apache2/sites-enabled.

If you want to edit the default config edit /etc/apache2/sites-available/000-default.conf.

1
  • how to open this directory /var/www/html Feb 22, 2016 at 13:06
1

The Directory directive doesn't define the root. Rather it defines how Apache should treat files inside that directory, if they are being served. Files outside the root could also be served if they were accessed through an Alias.

The reason the Apache configuration sets the options for all of /var/www might be such that you can easily have multiple sites, each with their own DocumentRoot. That way you don't have to repeat Directory in each site.

-1

you can costumize root directory every where that you want. it's not a bug. it had a reason that they change it. they want to not to put files directly into www directory.

3
  • I think it should point like this <Directoy /var/www/html> on default, otherwise it's just confusing. Anyway thanks.
    – Peco
    Aug 31, 2014 at 6:01
  • as developer, you don't have permission to change apache.conf, so you must put your configs in haccess. and they can't change apache.conf if they do, maybe your customized configs will be remove. Aug 31, 2014 at 6:04
  • @MortezaSoltanabadiyan he's asking why it says /var/www in apache2.config but the actual root is /var/www/html. It's nothing to do with htaccess files.
    – thexacre
    Aug 31, 2014 at 6:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .