[英]Apache Http Basic Authentication - Forbidden Error 403
I was doing the basic authentication to access the web pages via dispatcher. 我正在执行基本身份验证以通过调度程序访问网页。 I have gone through some blog and was able to achieve it, but only for one directory.
我浏览了一些博客并能够实现它,但是仅针对一个目录。 Below is the virtual host that i configured.
以下是我配置的虚拟主机。
<VirtualHost *:80>
ServerAdmin admin@aemcorner.com
ServerName aemcorner.com
ServerAlias www.aemcorner.com
#DocumentRoot /var/www/example.com/public_html
DocumentRoot /opt/communique/dispatcher/cache
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /content/practice/en/hello/secure-pages>
# <Directory /var/www/example.com/public_html>
AuthType Basic
AuthName "Secure Content"
AuthBasicProvider file
AuthUserFile /etc/apache2/passwords
Require all granted
</Directory>
</VirtualHost>
Here i want to work with the commented lines, this snippet work fine but when i replace it with /content/practice/en/Secure-Pages and use the commented DocumentRoot it give me an error as below : 在这里我想使用带注释的行,此代码段工作正常,但是当我将其替换为/ content / practice / en / Secure-Pages并使用带注释的DocumentRoot时,它给我一个错误,如下所示:
**Forbidden
You don't have permission to access /content/practice/en/hello/secure-pages/sp1.html on this server.**
I want to access the page /opt/communique/dispatcher/cache/content/practice/en/Secure-Pages/SP1.html
我想访问页面
/opt/communique/dispatcher/cache/content/practice/en/Secure-Pages/SP1.html
Also i am getting the below error : 我也收到以下错误:
[Mon Sep 07 20:57:39.500158 2015] [authz_core:error] [pid 9483:tid 140017092585216] [client 127.0.0.1:49543] AH01630: client denied by server configuration: /opt/communique/dispatcher/cache/favicon.ico, referer: http://aemcorner.com/content/practice/en/hello/secure-pages/sp1.html
I was able to solve this problem via below configuration : 我可以通过以下配置解决此问题:
<VirtualHost *:80>
ServerAdmin admin@aemcorner.com
ServerName aemcorner.com
ServerAlias www.aemcorner.com
#DocumentRoot /var/www/example.com/public_html
DocumentRoot /opt/communique/dispatcher/cache
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Location /content/practice/en/hello/secure-pages>
# <Directory /var/www/example.com/public_html>
AuthType Basic
AuthName "Secure Content"
AuthBasicProvider file
AuthUserFile /etc/apache2/passwords
Require valid-user
</Location>
</VirtualHost>
I have use Location
instead of Directory and Require valid-user
我使用
Location
而不是目录,并且Require valid-user
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.