0

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:

<VirtualHost *:80>
  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
  <Directory "/var/www/vhosts">
    AllowOverride All
    Order allow,deny
    Allow from all
    Options -Indexes
  </Directory>
</VirtualHost>

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
                             [  OK  ]
  • Only thing I can think of is vhosts is a file and not a directory. – LawrenceC Oct 17 '13 at 2:01
  • Yeah, what ultrasawblade said. Try ls -ald /var/www/vhosts – Paul Oct 17 '13 at 2:09
  • Not at all, my /var/www/vhosts/ is a directory :( – Tấn Triển Nguyễn Oct 17 '13 at 3:39
0

Check the following things...

  • Grep for DocumentRoot in your conf and ensure that the spelling is correct and the folder exists.

  • Check permission of your /var/www/vhosts. The apache user must have the permission to access it. (Give read permission to others)

  • Try setting SELinux to permissive mode. (type setenforce 0, it will change selinux mode to permissive temporarily )
  • Thank you. I've tried this "Try setting SELinux to permissive mode. (type setenforce 0, it will change selinux mode to permissive temporarily )" and my apache can restart ok. – Tấn Triển Nguyễn Oct 17 '13 at 6:25
  • SO the problem is with your selinux context of the DocumentRoot. If you dont have any issue in turning selinux as permissive, then you may do it by editing the file /etc/selinux/config ...In that you can set it to permissive. this change will be a permanent change and it will be effective only after a reboot. Or if you want to sort this out keeping selinux as enforcing, then set the selinux context of the document root to httpd_sys_content_t . Please mark my post as answer if you find it useful. – Unnikrishnan Oct 17 '13 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.