yum install httpd

service httpd restart

chkconfig httpd on

个人主页

vi /etc/httpd/conf/httpd.conf

#Userdir disable注释

Userdir public_html

:wq

service httpd restart

cd /home/aa

mkdir public_html

echo "this is a test page" > public_html/index.html

chomd -R a+rx /home/aa切记针对用户的宿主目录权限

chcon -R --reference /var/www/html /home/aa/public_html

restorecon -R -v /home/aa/public_html

虚拟主机

httpd -t检测httpd配置

NameVirtualHost 192.168.0.10


DocumentRoot /var/www/html

ServerName www.example.com

*****************************

authname "welcome to JS"**************************

authtype basic************************************密码保护的web

authuserfile /var/www/html/.htpasswd**************注意写在容器里面

require user bb***********************************

******************************************


htpasswd -mc /var/www/html/.htpasswd kevin

service httpd restart