1

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 [email protected]
    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 :

**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

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
2
  • The path of the file you're attempting to access is not within the path of the directory to which you're trying to allow access. Also make sure you're consistent with case sensitivity. Try changing to <Directory /content/practice/en/hello/secure-pages> Commented Sep 6, 2015 at 16:55
  • yes i did this, when i hit aemcorner.com/content/practice/en/hello/secure-pages/sp1.html url, it gives me same message You don't have permission to access /content/practice/en/hello/secure-pages/sp1.html on this server. updating question also Commented Sep 7, 2015 at 15:15

1 Answer 1

2

I was able to solve this problem via below configuration :

<VirtualHost *:80>
    ServerAdmin [email protected]
    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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.