php - apache 服务器 CentOS 中的访问权限

标签 php apache centos6

我安装了虚拟机CentOS 6.6。我还使用 yum 安装了 Apache、PHP、MySQL。

我将文档根目录从 /var/www/html 更改为 /www 所以我编辑了我的 /etc/httpd/httpd.conf 并更改了这两行:

DocumentRoot "/var/www/html"

<Directory "/var/www/html"> 

我重启了apache就没问题了。

当我尝试打开http://192.168.199.90/phpinfo.php 时出现问题。 我得到了:

Forbidden You don't have permission to access /phpinfo.php on this server.

我试图在 /etc/selinux/conf 中禁用 SElinux,并将 enforcing 更改为 disabled

我也试过这个:chcon -v -R --type=httpd_sys_content_t/www/

当我写 ls -laZ/www 时,我有:

drw-rw-rw-. www  www  unconfined_u:object_r:httpd_sys_content_t:s0 .
dr-xr-xr-x. root root system_u:object_r:root_t:s0      ..
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 phpinfo.php
drw-rw-rw-. www  www  unconfined_u:object_r:httpd_sys_content_t:s0 sites

最佳答案

谢谢大家,我重新收藏了

我更改了 SElinux 的当前模式 从 enforcingpermissive 通过在终端中写入:

设置强制 0

所以当我写的时候

getenforce 我得到 Permissive

我也做了 chmod 755 -Rf/www

;)

关于php - apache 服务器 CentOS 中的访问权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30032599/

相关文章:

php - IPN 验证 ipnSimulator 无效

apache - 如何使用非标准端口以非 root 身份运行 apache?

java - 如何在 apache karaf 中安装和运行 osgi bundle

linux - CentOS yum -y install 和 yum install 有什么区别

linux - 服务器分区上没有编号,无法挂载

php - 带有 Zend 的 Apache2 - 在错误的位置寻找 .htaccess

php - 从使用蓝牙/wifi 连接的移动设备访问 PC 上的本地主机

apache - 在不使用 .htaccess 的子文件夹上强制使用 https

linux - 无法使用 sysctl 更改每个进程的最大打开文件数

php - Laravel 中 isDirty() 是什么意思?