#!/bin/bash
#######################################################################
#
#                設定個人帳戶的home Page & 指定至 /var/www/html
#
#				Original Date: 2016.09.22
#				Last Updated:  2016.09.22
#				Author: Raymond Chou
#
#########################################################################

#Step1. 解開UserDir參數
sed -i 's/UserDir disabled/#UserDir disabled/g' /etc/httpd/conf.d/userdir.conf
sed -i 's/#UserDir public_html/UserDir public_html/g' /etc/httpd/conf.d/userdir.conf
sed -i 's/AllowOverride FileInfo AuthConfig Limit Indexes/AllowOverride All/g' /etc/httpd/conf.d/userdir.conf
sed -i 's/Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec/Options None/g' /etc/httpd/conf.d/userdir.conf
#重啟動httpd
systemctl restart httpd


#Step2. 製作david的public_html
mkdir /home/david/public_html
chown david.david /home/david/public_html
chmod 755 /home/david

#Step3. 將系統的Web root指向david的public_html
cd /var/www
mv html html.old
ln -s /home/david/public_html html
