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

StackOverflow https://stackoverflow.com/questions/19416757

  •  01-07-2022
  •  | 
  •  

Question

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
Was it helpful?

Solution

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.

OTHER TIPS

Try moving your vhosts folder inside the html folder and change the SELinux security context by running

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top