0

I got the problem when loading css file in my index.php. I already follow the answer of this question but it is not successful.

In index.php, I used this code:

 <link href="css/bootstrap.min.css" rel="stylesheet">

When I check the lsof -i tcp:80, the result is

httpd 4896 root 4u IPv6 324899 0t0 TCP *:http (LISTEN)

And I change the owner and permission of css folder as the answer

 drwxr-xr-x. 15 apache     apache      4096 Dec 23 00:40 css

EDIT: the permission of css file

-rwxr-xr-x.  1 apache apache  99548 Apr  5  2014 bootstrap.min.css

But it still get this

You don't have permission to access /css/bootstrap.min.css on this server.

Community
  • 1
  • 1
GAVD
  • 1,977
  • 3
  • 22
  • 40

3 Answers3

0

Check the permissions of that folder and those files in the server, and whether you can access them with your current permissions.

If not give them the 775 permission.

Omar Ayala
  • 154
  • 3
  • 11
0

What about the files permission? They are owned by apache as well? The best way to enforce the right permissions is to make apache the owner of the files as well.

Maybe doing a recursive chown can solve it.

chown -R apache:apache css

Another possible issue is the fact that your assets are relative the file where they are being included from. If your index is on foo/index.php and you asset is on foo/asset/css or bar/css they will not be found since you are using the relative notation:

<link href="css/bootstrap.min.css" rel="stylesheet">

If your index and css folder are on the same level you might use:

<link href="/css/bootstrap.min.css" rel="stylesheet">
Jean Carlo Machado
  • 1,480
  • 1
  • 15
  • 25
  • I already run command `chown` as your answer. It change owner from my acc to apache as you see in my question, but it is still not working. The link is correct, I don't need change anything. – GAVD May 11 '16 at 16:43
0

The problem comes from SELinux

SELinux is preventing httpd from read access on the file

So, my solution: running command

setsebool -P httpd_read_user_content 1

GAVD
  • 1,977
  • 3
  • 22
  • 40