linux http个人目录权限,httpd安装及创建个人发布目录

安装软件

# yum install httpd httpd-devel

启动

# /etc/init.d/httpd start

在浏览器中输入

http://localhost,即可访问

--------------------------------------------------------------------

配置文件

/etc/httpd/conf/httpd.conf

配置文件参数说明:

DocumentRoot "/var/www/html" 发布网站目录,即是http://localhost地址访问的目录

---------------------------------------------------------------------

创建个人发布目录

注意:关闭防火墙和selinux

# service iptables stop

# setenforce 0

添加用户:

#useradd lihui

创建发布目录:

mkdir /home/lihui/public_html

赋给访问权限

chmod -R +x  /home/lihui

在配置文件中,修改

 #默认发布目录名

UserDir public_html

Alias /lihui "/home/lihui/public_html/"  #个人目录的别名

#个人目录配置

Options Indexes MultiViews FollowSymLinks

AllowOverride All

Order deny,allow

Allow from all

浏览器输入

----------------------------------------------------------------

创建访问限制

家目录下添加用户密码 用户与系统用户无关# htpasswd -c .htpasswd tom

New password:

Re-type new password:

Adding password for user tom

#vim .htaccess,加入

authname "welcome to my homepage"

authtype basic

authuserfile "/home/lihui/public_html/.htpasswd"

require valid-user

service httpd restart

http://localhost/lihui,就需要输入刚刚的密码了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值