首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“警告: DocumentRoot [/var/www/vhosts]不存在”,尽管我已经创建了/var/www/vhosts?

“警告: DocumentRoot [/var/www/vhosts]不存在”,尽管我已经创建了/var/www/vhosts?
EN

Stack Overflow用户
提问于 2013-10-17 09:26:43
回答 2查看 20.7K关注 0票数 6

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

但是当我重启apache (使用以下命令: sudo service httpd restart )时,它警告我“警告: DocumentRoot /var/www/vhosts不存在”。我检查了目录/var/www/vhosts,它已经创建了,权限是0777。我做错了什么?有什么需要帮忙的..。

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

代码语言:javascript
复制
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

……

->,下面是警告:

代码语言:javascript
复制
[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
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-10-18 00:56:17

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

以下问题提供了有关如何启用DocumentRoot的指导原则:

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

  • http://wiki.centos.org/HowTos/SELinux
  • http://fedoraproject.org/wiki/SELinux
票数 4
EN

Stack Overflow用户

发布于 2013-12-19 19:55:44

尝试移动html文件夹中的vhosts文件夹,并通过运行以下命令更改SELinux安全上下文

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19416757

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档