1

After moving my httpd directory to my new install of Fedora 27, every page (php and html) has an "Access Denied." error and every directory returns a 403. I've tried changing the permissions of the httpd directory, but it hasn't worked.

Strangely, the Fedora localhost/ default page works fine.

  • 2
    Is selinux in the picture? – Jeff Schaller Nov 19 '17 at 23:31
  • 2
    If you went from Apache 2.2 to 2.4 the grant permissions syntax has changed in your <directory...> stanzas. – ivanivan Nov 19 '17 at 23:39
  • What does the error log say? What permissions do you have on the target directories and files (one or two examples will suffice)? – roaima Nov 20 '17 at 0:14
  • Thanks. I have tried changing the permissions to give every user read/write access and www ownership. SeLinux is enabled, but the troubleshooter shows no activity. I'm not sure what apache version Fedora 26 uses, but changing apache versions shouldn't have mattered much since I just moved the files within var/www/html to the new var/www/html -- the apache installation and conf files are all brand new. – John S Nov 20 '17 at 2:04
2

Just what Jeff was mentioning above - this sounds like classic SELINUX. Anytime I install Fedora and test httpd, the main page will come up fine but attempting to move to another page will fail. What I ended up doing was changing the context by copying from a directory that would work (e.g. the default page). Here's the simple answer that I found that worked:

chcon -R --reference=/var/www /path/to/webroot

And the site that I found the answer that worked (for me): Pete Freitag

  • Thanks. I wonder why this happens with SELINUX, especially since both directories were made by the same installation process at the same time -- and never effected me before. – John S Nov 20 '17 at 2:40
  • 1
    If you (or a program) created the files in a directory with a different SELinux context, then the mv probably preserved that context, causing the issue. – Jeff Schaller Nov 20 '17 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.