Question

I need some help figuring why apache tells me that my document root does not exists.

My document root is /home/user/Documents/Git/site/index.html... It is there!

My vhost looks like

<VirtualHost *:80>
    ServerName site.com
    DocumentRoot /home/user/Documents/Git/site/index.html
    ErrorLog /home/user/Documents/Git/site/error.log
    <Directory /home/user/Documents/Git/site>
        Require all granted
    </Directory>
</VirtualHost>

Permissions are 775 for Git and its subfolders and files and in my hosts 127.0.1.1 site.com

What am I doing wrong?

Thanks

Was it helpful?

Solution

Your document root cannot be a file, it must be a directory.

OTHER TIPS

Use below command to know where is the apache configure file is: then to update the document root:

# apache2ctl -S   [On Debian/Ubuntu]
# apachectl -S    [On CentOS/RHEL]
OR
# httpd -S

it shows below:

AH00112: Warning: DocumentRoot [/usr/local/opt/httpd24/Users/YOURNAME/SOMESITE] does not exist
AH00112: Warning: DocumentRoot [/usr/local/opt/httpd24/c:/dev/blog] does not exist
VirtualHost configuration:
127.0.0.1:80           blog.localhost (/usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf:29)
172.18.0.4:80          Somesite.localhost (/usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf:24)
ServerRoot: "/usr/local/opt/httpd24"
Main DocumentRoot: "/Users/YOURNAME/Sites"
Main ErrorLog: "/usr/local/var/log/apache2/error_log"
Mutex rewrite-map: using_defaults
Mutex default: dir="/usr/local/var/run/apache2/" mechanism=default 
Mutex mpm-accept: using_defaults
PidFile: "/usr/local/var/run/apache2/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="YOURNAME" id=501 not_used
Group: name="staff" id=20 not_used

In this case , you will know the warning, then update the Vhost file to delete the Vhosts.

   sudo nano /usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf

It works!!!

Yes, document root can not be a file such as index.html. Create a root like /var/www. Not like /var/www/index.html

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