Ask Your Question

Help! Getting a "403 Forbidden" when trying to view localhost files!

asked 2013-05-24 14:56:24 -0500

3Joe3 gravatar image

I attempted to change my localhost directory... it didn't work. I then put everything back the way it was. I re-inserted the original httpd.conf and put all the localhost files back.

But... now it's broken. Everything is the same as it was, but I can't access my file through a browser.

What am I doing wrong?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-05-25 08:29:04 -0500

Rabin gravatar image

updated 2013-05-25 08:31:13 -0500

Disabling SELinux is not the right way to solve this, when you change the default location of Apache hosting file, you need to relabel them (as Apache binary file is not allowed to serve/access any content except /var/www/html, not even users home folder public_html by default)

for the past year troubleshooting SELinux problems became much more each, and you can even find the needed instruction to fix the problem in the event log.

you can read a quick guide on Fedora/CentOS/Redhat sites - e.g.

edit flag offensive delete link more


Well, both files are back to the originals and everything is somehow fixed. Do you think maybe restarting the Apache server several times did the trick?

3Joe3 gravatar image3Joe3 ( 2013-05-26 00:19:10 -0500 )edit

answered 2013-05-24 15:14:03 -0500

3Joe3 gravatar image

I solved this by editing the SELinux config file.

I changed:




And changed:




I then restarted my computer and things worked. Weirdly though, I changed them back and restarted again and now everything works still.

I don't know if by changing it and changing it back I "reset" something or what.

edit flag offensive delete link more


Disabling SELinux is probably the wrong way to go. See the other answer for more details.

wquine gravatar imagewquine ( 2013-05-25 17:10:44 -0500 )edit

Question Tools


Asked: 2013-05-24 14:56:24 -0500

Seen: 2,713 times

Last updated: May 25 '13