我面临以下情况。出于 Web 开发目的,我已经设法使用 VirtualBox 设置了一个 CentOS 7 来宾 VM。我已经安装了 LAMP 堆栈并配置了 Apache(vhost,添加了组 vboxsf 的 apache 成员,添加了防火墙规则)以访问 VirtualBox 共享文件夹。
GUEST CentOS 7 VM Guest机器的配置设置:
Virtual machine hostname: dickwan.dev
Shared Folders:
Name | Read-only | Auto-mount
------------------------------------
dickwan | no | yes
------------------------------------
Networking: NAT (with port forwarding rules)
Port Forwarding Rules:
Name | Protocol | Host IP | Host Port | Guest IP | Guest Port
--------------------------------------------------------------------------------------
HTTP | TCP | . . . | 8080 | . . . | 80
--------------------------------------------------------------------------------------
MariaDB | TCP | . . . | 9306 | . . . | 3306
--------------------------------------------------------------------------------------
SSH | TCP | . . . | 2222 | . . . | 22
现在在我的主机中,我打开一个浏览器并导航到(让我们说):
http://dickwan.dev:8080/server-status
我收到消息:
Forbidden
You don't have permission to access /server-status on this server.
我已经将问题归结为 SELinux 安全上下文类型问题。当 SELinux 被禁用时,一切正常(嗯......很好,嗯嗯)。
但在我看来,仅仅关闭安全功能是一种不好的做法。我尝试更改共享文件夹的上下文,但无法执行操作
是否有机会在不停用 SELinux 的情况下通过 Apache 访问共享文件夹?