1

I'm getting the error cited in the title when I try to browse locally to index.html (or any other file in the html-root directory I've specified, and I can't figure out why. What follows is the timeline leading up to my posting of this request for help/suggestions:

Yesterday, I did a brand-new install of LAMP on a stable-for-over-two-years Ubuntu 14.04 machine. I set everything up as specified here: https://help.ubuntu.com/community/ApacheMySQLPHP

The first thing I did after the install was to reconfigure apache2 to have a different html-root inside my home dir: /home/user/Websites/MySite/. I created an index.html in MySite and was able to browse to it using "http colon-backwhack-backwhack localhost" in Firefox. I then created a test.php file, to which I could also browse (http colon-backwhack-backwhack localhost/test.php) successfully.

This morning, I renamed MySite to MyNewSite. I created new apache2 config files (following the directions at the link specified above), just as I had yesterday. I've quadruple-checked that I don't have any typos in the config files. I've tried all the suggestions, or determined them not to be relevant, at the following locations: Apache 'You don't have permission to access / on this server'

(can't post 4 additional links because I don't have enough reputation points)

I don't know why it worked perfectly yesterday and changing it to point at a new directory hosed it. Specifically, why is apache2 trying to access anything in the root (/)? And what do I need to look at/change to get it working again?

  • 2
    You did reload the apache confs? sudo apache2ctl graceful, it could be trying to look in the old location, and the files aren't there anymore. – Progrock Dec 06 '15 at 23:34

2 Answers2

1

It sounds like your Apache user does not have permission to read the specified file in that directory. Be sure that www-data, which is the default user on Ubuntu, can read there.

More information here:

https://serverfault.com/a/357109

carnau
  • 11
  • 4
0

By combining carnau's suggestion, below, and Progrock's suggestion, above, I got it working!

As carnau suggested: I studied up on permissions and discovered that the permissions for the folders in question were not quite right. I was both the user-owner and the group-owner of the objects. I fixed that, making sure that www-data was the group-owner and that the www-data group had r-x permissions. All the objects are now set to "755" permissions.

Unfortunately, when I tried the browse to index.html, after fixing the permissions issue, I still got the same error.

Then I tried Progrock's solution. I didn't think it would change anything because I HAD reloaded apache2 after making changes to the config files, using sudo service apache2 reload. Apparently, sudo apache2ctl graceful does something different because after issuing that command, everything works fine now.

Thank you to carnau and Progrock!