Apache2 WebServer not allowing me to view website/files in /var/www

Posted on

Apache2 WebServer not allowing me to view website/files in /var/www – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, apache-2.2, ubuntu, , .

I used to be able to access websites/files that were stored in the directory

/var/www

I have not used this for a while, but now I have a need to store, media in this directory or in the directory

/var/www/images

I noticed that my apache web server wasnt running correctly so I did a complete package removal and then reinstalled, but I am still unable to access a test page

inde.html

in the directory

/var/www/index.html

by going to

http://myipaddresshere/index.html

Is there some initial configuration I need to do to allow me to store HTML and media files in this directory and be able to access them from the browser?

I dont remember having to do anything before.

Solution :

look at the apache2.conf & any related sites-enabled configs. It’s quite possible that the package removal didn’t remove them… and the install didn’t replace them. In particular look for 3 things. #1: the “ServerRoot” (or DocumentRoot if it’s a virtual host) and #2 look through all the entries & make sure you have at least ONE that has Allow from All (or your ip block) that includes your particular web root. #3 Check permissions. If the files are owned by root:root (or whoever) and have no global permissions… (i.e. rwxr-x—) the web server won’t have access to the files to dish ’em out. In most linux-based OSes… apache is running as either www-data or httpd… so change the ownership (or group) of the files to whatever apache is running as… or give enough permissions to the files to allow access to ’em.

You can also flip through the logs to see what kinds of other issues are happening… it typically is quite verbose & will report why something couldn’t be accessed.

Without more info about what error page you get… and/or info from your error.log… I can’t be more specific as to what to check for.

pretty sure /var/www/html is the Document root on ubuntu.

grep -r Root /etc/apache2

That command should tell you the documentroot or serverroot set for your system. You can watch the logs by doing

tail -f /var/log/apache2/FILE

Ctrl-C to quit, and the filenames vary by installation, but if memory service, access_log and error_log are the ones you’ll need.

Leave a Reply

Your email address will not be published.