我正在尝试configuration一个需要在根目录中进行密码保护的apache虚拟主机。 所以我创build了一个.htpasswd文件(使用sha密码)并configuration了.htaccess文件。 不pipe我做什么,在网页上我得到一个错误500(内部服务器错误),并在error.log我看到这个: /var/www/ninja/www/.htaccess: deny not allowed here 或者如果我从.htaccess中排除否定: AuthUserFile not allowed here .htpasswd和.htaccess文件对于apache都是可读的,并被设置为www-data用户和组。 我也尝试将这些规则添加到虚拟主机configuration文件,但是这也没有办法。 你能帮我吗? 谢谢! configuration文件apache: <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName ninja DocumentRoot /var/www/ninja/www ServerAlias ninja <Directory /var/www/ninja/www/> Options Indexes FollowSymLinks MultiViews AllowOverride FileInfo Indexes Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order […]
我已经在apacheconfiguration中使用这样的代码来保护密码的位置 <Location ~ "/admin.*"> AuthType Basic AuthName "Protected Area" AuthUserFile /home/user/public_html/.htpasswd Require valid-user </Location> 有没有办法使用htaccess文件做同样的事情? 我想要保护的位置在文件系统上并不存在,这是由mod_rewrite提供的可用位置
对于apache,有一个htpasswd实用程序,它可以用来为.htaccess访问限制等生成encryption密码。在Ubuntu中,我可以通过apache2-utils软件包进行安装,但是在Scientific Linux(Red Hat)中,我发现只有以下包,当我做yum search htpasswd : perl-Apache-Htpasswd.noarch : Manage Unix crypt-style password file 但这似乎并不是我正在寻找的软件包,因为它不包括htpasswd命令,而且当我在Ubuntu中执行apt-cache search htpasswd时,我得到: libapache-htpasswd-perl – Manage Unix crypt-style password file lighttpd – A fast webserver with minimal memory footprint nanoweb – HTTP server written in PHP apache2-utils – utility programs for webservers …其中第一个显然是与我在上面(?)find的那个相对应的那个。 那么,对于Red Hat / Scientific Linux,是否有与apache2-utils软件包或任何其他软件包(包括htpassd实用程序)的等价物? 至less我找不到