AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1014344
Accepted
Débora
Débora
Asked: 2020-04-27 23:23:44 +0800 CST2020-04-27 23:23:44 +0800 CST 2020-04-27 23:23:44 +0800 CST

httpd 无法访问外部目录-moodle

  • 772

我正在 rhel 实例中安装 moodle 。我想将目录“moodle”保留在 /var/www/http 之外。我遵循了这个文档。为了定义moodle目录,我将/etc/httpd/conf/httpd.conf文件更新如下:

<Directory "/usr/moodle_dir/moodle">
DirectoryIndex index.php
AcceptPathInfo on
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
Alias /moodle "/usr/moodle_dir/moodle" 

所有moodle内容都在moodle目录中。我禁用了 SELinux setenforce 0。

我将文件权限设置为:

chown -R apache:apache /usr/moodle_dir   

当我在浏览器中点击 URL 时,它说

您无权访问此服务器上的 /moodle。

谁能让我知道问题出在哪里?(当我将moodle目录放在www/http中时,浏览器中加载了moodle页面。)php版本7.3,rhel:7.7。Moodle 3.8.2 [最新]

更新: 我在 /var/www/html/test 中添加了一个目录,<Directory并相应地更新了条目Alias。然后它起作用了。这意味着,目录引用正在工作。还有其他东西阻止 httpd 访问外部 www/html 目录。

permissions httpd moodle apache-2.4
  • 1 1 个回答
  • 318 Views

1 个回答

  • Voted
  1. Best Answer
    Gerard H. Pille
    2020-04-29T00:13:12+08:002020-04-29T00:13:12+08:00

    使用 Apache 2.4,

    Order allow,deny
    Allow from all
    

    应该替换为

    Require all granted
    

    检查您的 php.ini,如果 open_basedir 尚未设置为 /var/www/html/...

    ; open_basedir, if set, limits all file operations to the defined directory
    ; and below.  This directive makes most sense if used in a per-directory
    ; or per-virtualhost web server configuration file.
    ; http://php.net/open-basedir
    ;open_basedir =
    

    另外,您是否正在使用 fpm-php,检查进程所有者以及是否在其配置中设置了 chroot,例如。/etc/php/7.0/fpm/pool.d/www.conf:

    ; Chroot to this directory at the start. This value must be defined as an
    ; absolute path. When this value is not set, chroot is not used.
    ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
    ; of its subdirectories. If the pool prefix is not set, the global prefix
    ; will be used instead.
    ; Note: chrooting is a great security feature and should be used whenever
    ;       possible. However, all PHP paths will be relative to the chroot
    ;       (error_log, sessions.save_path, ...).
    ; Default Value: not set
    ;chroot =
    
    • 1

相关问题

  • 如何在 Exchange 2007 中设置资源邮箱日历的忙/闲权限?

  • 共享文件夹中某些文件的访问被拒绝错误

  • Bash 脚本:要求脚本以 root 身份运行(或使用 sudo)

  • 如何授予用户安装 Windows 服务的能力?

  • 限制用户向电子邮件地址发送电子邮件

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve