- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个几乎可以肯定是新手的问题。我本来希望在写这个问题时找到问题,但我仍然卡住了。
我想更改 apache 的 DocumentRoot,但我不断收到错误消息“DocumentRoot 必须是目录”。
情况:
在httpd.conf中
DocumentRoot "/home/stave/www"
当我重新启动时,我收到消息
Starting httpd: Syntax error on line 292 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
迄今为止采取的步骤:
我确保该目录存在:
ls -asl /home/stave
4 drwxrwxrwx. 2 stave stave 4096 Feb 9 09:08 www
It even has a file in it "index.html", so I am very sure that the directory exists
我认为这可能是一个权限问题,所以(这是一个与互联网隔离的虚拟开发机器,我正在排除故障,所以我不太担心安全性)正如你所看到的,我将权限设置为 777。
我什至将 apache 运行的用户更改为 stave(并确认该更改适用于 ps),以确保权限不应该成为问题。
Stackoverflow
有一些堆栈溢出的答案,但大多数都说“阅读错误消息。它说该目录实际上并不存在”。其他人暗示末尾可能有一个尾部斜杠,这会很糟糕。
其他网站
我发现最有用的是 this这建议
由于 SELinux 扩展,您可能会收到“DocumentRoot 必须是目录”错误,即使它实际上是一个目录。运行 system-config-securitylevel (或 redhat-config-securitylevel)以禁用 httpd 的 SELinux 或授予 SELinux 权限目录: chcon -R -h -t httpd_sys_content_t/路径/到/目录*
我的Linux版本不是SecurityEnhancedLinux,所以在不理解的情况下我还是尝试了它:没有效果。
现状
我已经没有办法尝试了,因此任何诊断问题或建议将不胜感激
最佳答案
您在“其他网站”下发布的链接突出显示了问题的根本原因,即 Selinux。
除非服务器是 super 安全环境的一部分,否则我会简单地禁用 Selinux。
在 RedHat/CentOS/Scientific Linux 上,可以通过编辑/etc/sysconfig/selinux 轻松完成此操作 - 找到参数“selinux”并将选项“enforcing”更改为“disabled”,如下摘录所示:
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
进行此更改后重新启动服务器可能是明智之举。
关于apache2 - Apache重启导致DocumentRoot必须是目录,尽管是目录而且似乎没有权限问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14786881/
我想配置我的 apache 不同。现在,如果缺少 DocumentRoots 之一,则所有服务器都无法启动。这很烦人。。 有什么选择,如何忽略这个错误? 最佳答案 基于您的 DocumentRoot
如何在 apache 中进行以下设置? http://server/ABC/*应由 /var/www/ABC/* 提供服务 http://server/PQR/*应由 /var/www/PQR/* 提
我正在使用 Arch Linux 3.0-ARCH。我已经将 /etc/httpd/conf/httpd.conf 中的 DocumentRoot 从 /srv/http 更改为 /var/万维网。然
我在 ubuntu 上安装了 apache2,我将 DocumentRoot 值更改为我的工作文件夹。我的文件夹路径是 /home/user/My\Works/sites 所以我将我的 Documen
我正在尝试查找对 /var/www/html 的引用仍然存在于我的 Apache 配置中。当我运行 apache2ctl -S它说Main DocumentRoot: "/var/www/html"
我在我的服务器上设置了 mercurial,但我不清楚事情应该如何。我正在寻找更多不同设置的示例,但也许我使用了错误的关键字。现在,只有少数开发人员,我不确定是否应该将 repo 作为 Documen
不要认为我的虚拟主机工作正常。这是我在 httpd.conf 中的内容……这是文件中的最后一件事: NameVirtualHost *:80 DocumentRoot /var/www/html/t
我正在构建一个 Zend 网站。该项目(本地)具有以下结构: /app /controllers /views /public /css /images /js .
我正在尝试将 httpd.conf 中的 DocumentRoot 从 /var/www 更改为 /var/www/shop 以便我可以组织起来。但即使我在重新启动 apache 和 httpd 后这
我使用 CentOS 5.8 获得了我的新 VPS 服务器,我还不能转移我的域,但我想通过 http://my-server-ip 访问我的站点,因为我使用的是 laravel框架 我需要将默认
NameVirtualHost *:80 ServerName tmp DocumentRoot "//192.168.1.25/www/" Options Indexes FollowSymLi
我的 .htaccess 文件中有 DocumentRoot/var/www/test 。这导致 apache 服务器给我一个 500 内部服务器错误。 错误日志文件显示: 警报] [客户端 127.
假设我有以下配置: # Server names, admins, logs etc... ProxyVia On ProxyRequests Off
我有下一个文件结构: .htaccess index.php public/ ├─ v1/ │ ├─ .htaccess │ ├─ index.php ├─ index.php 我已将服务器级别的
我有下一个文件结构: .htaccess index.php public/ ├─ v1/ │ ├─ .htaccess │ ├─ index.php ├─ index.php 我已将服务器级别的
我需要将一个子目录设置为 DocumentRoot,以便在 slim 框架上运行我的应用程序。有什么办法吗? 我尝试使用 htaccess 文件但没有成功:根: RewriteEngine On Re
我正在使用 EMF,并从 XSD 创建了我的 ecore。 我注意到编辑器保存的 XML 具有元素 DocumentRoot,它不是我原始 XSD 的一部分。我可以以某种方式不生成它,这样它就不会出现
我在/var/www/html 中安装了一个 codeigniter 项目。URL 应如下所示:http://example.com/clients/abc我正在运行 CentOS 和 Apache
我正在运行 ubuntu 18.4,安装了 digitalocean lamp,包括 quickstart ssl。我在服务器上的子目录 /var/www/html/moodle 中成功安装了 moo
我在这里拉扯我的头发。 我让 Apache 与两个不同的域一起运行,这些域使用 SNI 运行 SSL。 配置如下。如果我连接到 console.somedomain.com,它会将用户放在/var/w
我是一名优秀的程序员,十分优秀!