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?
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.
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.
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.
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.
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!
- 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.
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.
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
.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With