开发者

Apache forbidden

I've been testing usage of apache authentication, following this example.

I'm using Ubuntu/Apache2.

Inside of my 'site', /etc/apache2/sites-enabled/playcat, which is pointing to /home/playcat/public_htm开发者_如何学Pythonl, I entered following:

<Directory "/home/playcat/public_html/backend">
    AuthType Basic
    AuthName "Restricted Content"
    AuthBasicProvider file
    AuthUserFile /home/playcat/passwd/passwords
    Require user playcat
</Directory>

Password for user playcat was created via

htpasswd -c /home/playcat/passwd/passwords playcat

Obviously, before that I created passwd folder :).

Now, when I open http://localhost/backend, I get promped for u/p combination. However, when I type it, I get 403 response.

Other than that, server is working a-ok. I have php and mysql installed, and everything works fine.

Did I miss smt?

Thx

p.s. I'm using correct user/pass combo :)


Try to change the

<Directory "/home/playcat/public_html/backend"> 

to

<Directory /home/playcat/public_html/backend>

That is how it is supposed to be written according to the spec:

http://httpd.apache.org/docs/current/mod/core.html#directory

Here is an example that works for me:

  <Directory /path/to/web/site/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All

    Order deny,allow
    AuthType Basic
    AuthName "Restricted Files"
    # (Following line optional)
    AuthBasicProvider file
    AuthUserFile /path/to/htpasswd
    Require valid-user
  </Directory>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜