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.

1
  • What are the file's permissions? Can you post your apache config? Commented May 11, 2016 at 16:35

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

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">

1 Comment

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.
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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.