密码保护Apache的网站,它的所有内容需要被保护 [英] Password protect apache site and all of it's content need to be protected

查看:107
本文介绍了密码保护Apache的网站,它的所有内容需要被保护的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有主办一群人在使用的Apache。我想给个别登录那些人。此外,我想保护整个网站包括非脚本内容与密码。是否有可能做的.htaccess和密码文件?

I have a apache hosting for use within a group of people. And I want to give individual login to those people. Additionally I want to protect entire web site including non script content with password. Is it possible to do with .htaccess and password file?

推荐答案

这可以通过下面的方法做。

This can be done through following method.

创建密码文件和UNIX分配登录。

Create password file and assign login on unix.

首播时间:须藤的htpasswd -c的/ etc / apache2的/网站的可用/ passwd文件nameofuser

在第一时间:须藤的htpasswd在/ etc / apache2的/网站的可用/ passwd文件nameofuser

在网站上分配密码的内容。

assign password to contents on the site

须藤的vim的/ etc / apache2的/网站的可用/默认

    <LocationMatch "/.*">
            AuthType Basic
            AuthName "Password required"
            AuthUserFile /etc/apache2/sites-available/passwd
            Require valid-user
    </LocationMatch>

须藤/etc/init.d/apache2重启

这篇关于密码保护Apache的网站,它的所有内容需要被保护的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆