“Warning: DocumentRoot [/var/www/vhosts] does not exist” although I've created /var/www/vhosts?

Tấn Triển Nguyễn picture Tấn Triển Nguyễn · Oct 17, 2013 · Viewed 20.5k times · Source

I've installed apache and config my virtual host on my CentOS 6.4.

But when i restart apache ( using this command : sudo service httpd restart ) it's warning me that "Warning: DocumentRoot [/var/www/vhosts] does not exist". I've check the directory /var/www/vhosts, it already created and permission is 0777. What wrong i did? any help please...

-> this is my virtual hosts configuration.

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

....

-> and this is the warning:

[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

Answer

Zac Thompson picture Zac Thompson · Oct 17, 2013

I think you are probably running with SELinux enabled. This requires additional steps to make resources accessible (which is good for security).

These questions have guidelines on how to enable your DocumentRoot:

If you don't want to work with SELinux, you can disable it by setting SELINUX=disabled in /etc/selinux/config. The following links might help if you want to learn more.