Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why has the apache2 www dir been moved to /var/www/html?

Tags:

apache

apache2

I just upgraded my server and saw that the default.conf file in sites-available was now pointing to /var/www/html instead of /var/www. What was the reason for this change?

like image 849
f.ardelian Avatar asked Feb 09 '14 14:02

f.ardelian


People also ask

Why we use var www html?

What exactly does /var/www/html mean? This is the default path that the more popular web servers use as the default. You should use the folder path your host says to use. It's the base directory for your website.

Where is directory var www html?

Introduction. On Ubuntu, the Apache web server stores its documents in /var/www/html , which is typically located on the root filesystem with rest of the operating system.

What permissions should var www html have?

root is the default owner of files & folders in /var/www/html folder (which is typically Document Root) for your website. Also the file permissions are 755. It means other users cannot access these files easily.

Why does Apache only serve PHP files inside a directory?

Because it is not configured to do so, by default Apache will only serve php file inside /var/www/html directory. You can set Apache to look content anywhere within your system, in order to achieve such thing you need to change Apache setting, they are mostly located on /etc/apache2.

How to use/WWW as root folder in Apache2?

If you want to use /www as root folder instead of /www/html you can simply edit the apache2 config file to have /var/www Thanks for contributing an answer to Stack Overflow!

Why is the root directory on a web server in/var/www?

- Unix & Linux Stack Exchange Why is the root directory on a web server put by default in "/var/www"? Bookmark this question. Show activity on this post. This directory contains variable data that changes constantly when the system is running. /var contains variable data files.

What does this line set the Apache document root to?

This line sets the Apache document root for the website to the directory. The block of code between the Directory tags simply enables directory listings in Apache and is safe to ignore if you are not following this tutorial verbatim.


2 Answers

I found the bug report: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=730372

The report was filed after this mailing list discussion: https://lists.debian.org/debian-devel/2012/04/msg00301.html

Summary: Site admins usually place sites in /var/www/site.com and there may be sensitive data in /var/www that should not be made available via a web server. All web servers on Debian have been updated to use /var/www/html as default instead of /var/www.

like image 57
f.ardelian Avatar answered Sep 26 '22 01:09

f.ardelian


I edited /etc/apache2/sites-enabled/000-default.conf to fix this (changed the DocumentRoot line).

The reason given for this breaking change is nonsense. Why would a site administrator put sensitive files that aren't supposed to be served to the web in /var/www , of all places? I'm just a developer and I know what that directory does.

If an administrator is lazy or incompetent enough to put sensitive files in /var/www, nothing will stop them from putting those files in /var/www/html now. And since when does Linux break backward compatibility in a useless attempt to prevent administrators from doing really dumb things?

like image 21
Andrew Koster Avatar answered Sep 23 '22 01:09

Andrew Koster