mercredi 26 avril 2017

Change RootDirectory for apache2 httpd in CentOS

OK. I know this topic sounds like it's been asked a thousand times and has been answered a million times. And it has been asked so many times and there are so many answers.

However, I haven't been able to diagnose why is my configuration not working. Here/s my situation:

I've setup a CentOS7 system for my web development and have managed to install apache2 httpd on it.

On normal setup it works just fine and successfully shows the index.html file i've put in the folder:

//var/www/html'

Here's the permission for the index.html: enter image description here

Now I've changed the configuration file

/etc/httpd/conf/httpd.conf

and made the following changes:

   DocumentRoot "/home/ftpuser"

#
# Relax access to content within /var/www.
#
<Directory "/home/ftpuser">
    AllowOverride None
    # Allow open access:
        Require all granted
    </Directory>

    # Further relax access to the default document root:
    <Directory "/home/ftpuser">

Changed the DocumentRoot to '/home/ftpuser'. and changed the same value for both Directory Directives and I get this:

enter image description here I've double checked the file permissions and ownership and made sure everything is the same as the /var/www/html folder/ But apache2 still shows the same error message.

Now if I change the directory to somewhere inside the /var/www and change the httpd.conf parameters accordingly then the server works fine.

I've tried everything before posting a question. So please give me details on what I've missed. I've tried all day and haven't been able to find the right answer. I've also been referring to this resource online: Centos:httpd directives

PS: I haven't looked too much in detail about using VirtualHosts. I wanted to configure the main server and use it from my home directory /home/ftpuser.




Aucun commentaire:

Enregistrer un commentaire