Linux serverNETWORK ADMINISTRATIONS

Serve Webpages from User's Home Directory with Apache on CentOS 7 (SElinux Version))

This video demonstrates the configuration of Apache webserver on CentOS 7 for serving webpages from the users home directory. So that every users on your system can have his/her own website and it can be accessed from the browser as http://ip-addr/~username
This video also demonstrates the configuration of SElinux for Apache.

Tested on: CentOS 7
Apache Version: 2.4.6 (x86_64)

Steps and Commands:
1. install apache
sudo yum install httpd -y

2. enable userdir
sudo vi /etc/httpd/conf.d/userdir.conf

3. restart apache
sudo systemctl restart httpd

4. make $HOME executable
sudo chmod a+x $HOME

5. create public_html under home
mkdir $HOME/public_html

6. create a dummy html file
vim index.html

7. selinux
sudo chcon -Rt httpd_sys_content_t public_html

8. open port 80 on the firewall
sudo firewall-cmd –add-port=80/tcp –permanent

9. restart firewalld
sudo systemctl restart firewalld

10. find ip address of the server
ip addr show | grep inet

11. test on the browser via http://ip_addr/~username/

source

centos 7

Leave a Reply

Your email address will not be published. Required fields are marked *