通过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
在输入用户密码,就可以访问