续虚拟主机
1. 修改httpd的主配置文件
删除之前对httpd.conf所做操作,搜索UserDir,将UserDir disabled注释掉,它可能影响个人主页功能的开启,同时启用个人主页功能UserDir public_html)确认目录区域设置
vim /etc/httpd/conf/httpd.conf
# UserDir disabled
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disabled" line above, and uncomment
# the following line instead:
#
UserDir public_html
</IfModule>
<Directory /home/cai/public_html>
AllowOverride none
Options none
Order allow,deny
Allow from all
</Directory>
2.创建对应用户,并设置密码
useradd cai
passwd cai
3.创建配置文件中的目录,并编辑主页内容
mkdir /home/cai/public_html
vim /home/cai/public_html/index.html
hahahha
4.赋予用户目录权限
chmod 755 /home/cai
5.重启服务并在火狐浏览器验证
service httpd restart
成功!