2021-10-02 linux学习-部署(三) 之个人用户主页功能

一 使用httpd服务程序提供的个人用户主页功能

1 开启用户主页功能

vim /etc/httpd/conf.d/userdir.conf

注释第17行

# UserDir disabled

开启24行

UserDir public_html

2 创建首页文件

mkdir public_html
echo "This is linuxprobe's website" > public_html/index.html
chmod -R 755 /home/linuxprobe

3 重启httpd服务

systemctl restart httpd

4 开启SElinux个人主页域功能

setsebool -P httpd_enable_homedirs=on

二 在网站中添加密码

有时,网站的拥有者并不希望直接将网页内容显示出来,而只想让通过身份验证的用户看到里面的内容,这时就可以在网站中添加密码功能

1 生成密码数据库

htpasswd -c /etc/httpd/passwd 用户名

2 编辑个人用户主页功能的配置文件

vim /etc/httpd/conf.d/userdir.conf
 31 <Directory "/home/*/public_html">
 32     AllowOverride all 
        #刚刚生成出的密码验证文件保存路径
 33     authuserfile "/etc/httpd/passwd" 
        #当用户访问网站时的提示信息
 34     authname "My privately website"
        #验证方式为口令模式
 35     authtype basic
        #访问网站时需要验证的用户名称
 36     require user 用户名
 37 </Directory>

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

鹅一只

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值