文件共享,用户主界面认证

通过http/https实现文件共享

目录标签 options +indexes
indexes 默认加载directoryindex目录标签后,当目录directoryindex找不到对应网页文件(删除主路径下的index.html,以及欢迎界面)会加载mod_autoindex会将网站主路径下的文件格式为目录列表提供客户端主机访问。

[root@rhce ~]# vim /etc/httpd/conf.d/vhosts.conf

在这里插入图片描述

[root@rhce ~]# rm -rf /ssl/index.html
[root@rhce ~]# touch /ssl/{1..3}
[root@rhce ~]# vim /etc/httpd/conf.d/welcome.conf 

在这里插入图片描述
在这里插入图片描述
点击文件,目标另存为,选择好位置。保存
就可以实现文件共享了

配置用户主界面认证

更改用户主界面配置

[root@rhce ~]# vim /etc/httpd/conf.d/userdir.conf

在这里插入图片描述

创建资源信息

[root@rhce ~]# useradd tom
[root@rhce ~]# cd /home/tom
[root@rhce tom]# mkdir public_html
[root@rhce tom]# echo hellow tom > /home/tom/public_html/index.html
[root@rhce tom]# chmod o+rx /home/tom  添加权限
[root@rhce tom]# htpasswd -c /etc/httpd/userfile tom 添加用户认证

重启服务

[root@rhce ~]# systemctl restart httpd

关闭防火墙和selinux

[root@rhce ~]# systemctl stop firewalld
[root@rhce tom]# setenforce 0

测试

浏览器测试:
http://192.168.81.138/~tom
在输入用户密码,就可以访问
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_64311421/article/details/130671112
今日推荐