Thursday, December 13, 2012

Change Root Directory of httpd on Fedora

in here, i using fedora 17.

The default root directory is at /var/www/html. In my case, I want to change it to /home/user/web.

1.  edit file apache configuration you mus as root access

sudo gedit /etc/httpd/conf/httpd.conf

Find these two lines

DocumentRoot "/var/www/html"

<Directory "/var/www/html">

then, change to

DocumentRoot "/home/user/www"

<Directory "/home/user/www">

before edit this file you must create folder as name www or other name.

2. Changing permission

chmod 711 /home/user
chmod -R 755 /home/user/www

and then, configuration as bellow

setsebool -P httpd_enable_homedirs 1
chcon -R -t httpd_sys_content_t /home/user/www
apache can access your folder www. you mus configuration access. and now follow this step.
chown root:user /home/user/www

restart your apache:

service restart httpd or systemctl restart httpd.service

create some file on folder www and open in your browser.

good luck and hopefully useful.
sorry, if my english not so good. 

No comments:

Post a Comment