第一步:挂载,安装,关闭防火墙和selinux
[root@localhost hh]# mount /dev/sr0 /mnt
[root@localhost hh]# yum install httpd
[root@localhost hh]# systemctl stop firewalld
[root@localhost hh]# setenforce 0
第二步:更改配置,实现自定义设置
[root@localhost hh]# cd /etc/httpd/conf.d
[root@localhost conf.d]# vim hhh.conf
<VirtualHost 192.168.164.80:24>
Servername www.openlab.com
DocumentRoot /www/openlab
</VirtualHost>
<Directory /www/>
AllowOverride none
Require all granted
</Directory>
手动建立连接
[root@localhost conf.d]# cd /etc
[root@localhost etc]# vim hosts
192.168.164.80 www.openlab.com
创建目录
[root@localhost etc]# mkdir /www/openlab
[root@localhost etc]# echo welcome to openlab > /www/openlab/index.html
测试:
[root@localhost etc]# curl http://www.openlab.com
welcome to openlab
第一步:创建目录
[root@localhost etc]# cd /root
[root@localhost ~]# mkdir {student,data,money}
修改权限:[root@localhost ~]# chmod /root 777
第二步:添加内容
[root@localhost ~]# echo who is money > /root/money/index.html
[root@localhost ~]# echo who is data > /root/data/index.html
[root@localhost ~]# echo who is student > /root/student/index.html
第一步:创建用户
[root@localhost ~]# htpasswd -c /etc/httpd/users song
New password:
Re-type new password:
htpasswd: password verification error
[root@localhost ~]# htpasswd /etc/httpd/users tian
New password:
Re-type new password:
Adding password for user tian
第二步:用户访问控制
<Directory /www/openlab/student>
AllowOverride none
AuthType Basic
AuthName "Please Login..."
AuthUserfile /etc/httpd/users
Require user song tian
</Directory>