【问题标题】:“Warning: DocumentRoot [/var/www/vhosts] does not exist” although I've created /var/www/vhosts?“警告:DocumentRoot [/var/www/vhosts] 不存在”虽然我创建了 /var/www/vhosts?
【发布时间】:2013-10-25 08:31:09
【问题描述】:

我已经在我的 CentOS 6.4 上安装了 apache 并配置了我的虚拟主机。

但是当我重新启动 apache(使用此命令:sudo service httpd restart)时,它警告我“警告:DocumentRoot [/var/www/vhosts] 不存在”。我检查了目录/var/www/vhosts,它已经创建并且权限是0777。我做错了什么?任何帮助请...

->这是我的虚拟主机配置。

DocumentRoot /var/www/vhosts
ServerName trien.cba
ServerAlias trien.cba
ErrorLog /var/log/httpd/trien.cba.error.log
CustomLog /var/log/httpd/trien.cba.access.log common
AllowOverride All
Order allow,deny
Allow from all
Options -Indexes

....

-> 这是警告:

[root@test-cba ~]#sudo service httpd restart
Stopping httpd: [ OK ]
Starting httpd: Warning: DocumentRoot [/var/www/vhosts] does not exist
Warning: DocumentRoot [/var/www/vhosts] does not exist

【问题讨论】:

  • ls -ld /var/www/vhosts 的输出?
  • @Zac Thompson:这是输出:drwxrwxrwx。 3 root root 4096 Oct 16 16:23 /var/www/vhosts

标签: apache document-root


【解决方案1】:

尝试将 vhosts 文件夹移动到 html 文件夹中,并通过运行更改 SELinux 安全上下文

chcon -R --reference=/var/www/html /var/www/html/vhosts

【讨论】:

    【解决方案2】:

    我认为您可能在启用 SELinux 的情况下运行。这需要额外的步骤来使资源可访问(这有利于安全性)。

    这些问题提供了有关如何启用 DocumentRoot 的指南:

    如果您不想使用 SELinux,可以通过在 /etc/selinux/config 中设置 SELINUX=disabled 来禁用它。如果您想了解更多信息,以下链接可能会有所帮助。

    【讨论】:

      猜你喜欢
      • 2020-02-26
      • 2014-02-13
      • 2020-01-10
      • 1970-01-01
      • 1970-01-01
      • 2015-06-23
      • 2016-08-27
      • 2014-03-16
      • 2017-10-09
      相关资源
      最近更新 更多