CentOS Apache配置详解 文字说明

2019-10-15 13:19:51丽君

<Directory "/var/ftp/pub">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
在Options 加入 MultiViews   //没有index时自动列出目录文档
然后重启服务,这样http://192.168.76.133/down/里面就可以列出/var/ftp/pub里面的文件了,试着点一个另存为,是否可以下载? 呵呵 成功!

6:.htpasswd的实现
#vi /etc/httpd/conf/httpd.conf
我们针对刚刚做的/var/ftp/pub来做
加入如下信息
Alias /down "/var/ftp/pub/"
<Directory "/var/ftp/pub">
    Options Indexes MultiViews
    AllowOverride AuthConfig
    Order allow,deny
    Allow from all
</Directory>
<Directory "/var/ftp/pub">
AuthType Basic
AuthName "this is test"
AuthUserFile /etc/httpd/htpasswd
Require User test
</Directory>
然后重启httpd服务,
让后生成.htpasswd用户密码
htpasswd -c /etc/httpd/htpasswd test
让后去访问192.168.76.133/down会需要密码
这样就成功了