VaT*_*aTo 4 permissions apache-httpd
我的服务器中有两个 pdf 文件:
-rwxr-xr-x. 1 apache apache 1422861 Sep 11 2014 file1.pdf
-rwxr-xr-x. 1 apache apache 340815 Aug 27 13:06 file2.pdf
Run Code Online (Sandbox Code Playgroud)
我可以通过访问www.myserver.com/pdffiles/file1.pdf来访问第一个
我刚刚上传了第二个文件并将权限更改为 apache:apache 和 rwxr-xr-x 所以我不会有权限问题,但是当我尝试使用www.myserver.com/pdffiles/file2.pdf访问第二个文件时我明白了:
禁止的
您无权访问此服务器上的 /pdffiles/file2.pdf。
我错过了什么?
我在 ssl_error_log 上得到以下信息:
[Thu Aug 27 13:30:46.755295 2015] [core:error] [pid 3025] (13)Permission denied: [client xxxx:60230] AH00132: 文件权限拒绝服务器访问: /var/www/myserver/file2.pdf
我不知道问题出在 SELinux 上,但我发现这是问题所在,因为我关闭了它setenforce 0,然后它就起作用了。这是我列出文件时的样子ls -alZ
-rwxr-xr-x. apache apache unconfined_u:object_r:httpd_sys_rw_content_t:s0 file1.pdf
-rwxr-xr-x. apache apache unconfined_u:object_r:user_home_t:s0 file2.pdf
Run Code Online (Sandbox Code Playgroud)
所以我修复了它:
chcon unconfined_u:object_r:httpd_sys_rw_content_t:s0 file2.pdf
Run Code Online (Sandbox Code Playgroud)
我还用setenforce 1.
| 归档时间: |
|
| 查看次数: |
1179 次 |
| 最近记录: |