Apache 2 user home directory
First create a directory with name public_html in your home directory (user directory
[ismail@localhost ~]$ mkdir public_html
Now open you apache server config file and edit to enable public_html for that uncomment UserDir public_html and comment UserDir disabled and also uncomments the lines below from where Directory start to ends
[ismail@localhost ~]$ sudo vi /etc/httpd/conf/httpd.conf
Now next step to save the configuration file and setting up permissions on public_html folder in your home directory. Our home directory need permission of 711 and public_html permission of 755 that we set by following commands.
[ismail@localhost ~]$ chmod 711 ~ismail/
where ismail is username you have your own you username you can check that by issuing command
[ismail@localhost ~]$ whoami
Alright now next step is to set permission of public_html
[ismail@localhost ~]$ chmod 755 public_html/
If SElinux is turned on you have to give extra permission on public_html folder
[ismail@localhost ~]$ sudo chcon -t httpd_sys_content_t public_html
last thing we have to do is comment welcome file in the following location
[ismail@localhost ~]$ vi /etc/httpd/conf.d/welcome.conf
Comment this whole file
Now we good to go just restart you web server
[ismail@localhost ~]$ sudo service httpd restart
Now open you web browser to test our public_html
[ismail@localhost ~]$ firefox localhost/~ismail &
or just simple type in your url
http://localhost/~ismail/
Last thing i wanna tell you is in whole this tutorial ismail was my username
After last step I got a message - "~username is not in the sudoers file. This incident will be reported." I need help to resolve the issue
ReplyDeleteYour blog has given me that thing which I never expect to get from all over the websites. Nice post guys!
ReplyDelete