2010-08-19 29 views
0

下面是我的虚拟主机(这是稍微修改,以掩盖某些URL):阿帕奇保护所有路径,但白名单的特定路径

 
    1 NameVirtualHost 192.168.1.49:80 
    2 
    3 <VirtualHost 192.168.1.49:80> 
    4 ServerName internal-name.local 
    5 ServerAlias *.internal-name.local external-domain.co.uk *.external-domain.co.uk 
    6 
    7 <Directory "/var/www/html"> 
    8  AllowOverride All 
    9 
10  Order deny,allow 
11  Deny from all 
12 
13  AuthName "Restricted Development Server" 
14  AuthUserFile /var/www/html/.htpasswd 
15  AuthType Basic 
16  Require valid-user 
17 
18  Allow From 192.168.1. 
19 
20  Satisfy Any 
21 </Directory> 
22 
23 <Location /open-path > 
24  Order Allow,Deny 
25  Allow From All 
26  Deny From None 
27 </Location> 
28 
29 LogLevel debug 
30 VirtualDocumentRoot /var/www/html/%1/ 
31 </VirtualHost> 

一切工作正常 - 每个子域获得的/ var中有自己的文件夹/ www/html等。来自192.168.1.x的任何请求(通过内部域映射)都可以在没有密码提示的情况下查看该站点。任何来自外部IP的请求(通过external-domain.co.uk)都将被提示输入密码。

我遇到的问题是让最后一个“位置”规则起作用。

我没有(无论是.htaccess或虚拟主机级别)使用或将禁用“/开放路径”URL的密码保护。

其实不然 - 这个服务器上的每个站点运行的Drupal它使用URL重写在.htaccess所有非文件映射到“Q =?” ......所以说: http://domain/foo/bar 映射到: http://domain/index.php?q=foo/bar

我不认为应该这样做,但应该吗?

我指出的原因是“/ open-path/callback”需要打开第三方API来“ping”该网站。我需要测试这个回调工作之前推动生活,但我不想揭示整个网站的密码保护。

我试着将位置设置为“/index.php?q=open-path”,这也不起作用。

任何建议将非常感谢!

回答

2

这是从Apache文档: http://httpd.apache.org/docs/2.2/mod/core.html#require

<Directory /path/to/protected/unprotected> 
# All access controls and authentication are disabled 
# in this directory 
Satisfy Any 
Allow from all 
</Directory> 

这与定位的作品,以及。

+0

工作完美! :-)对于大规模延迟回复的问题感到抱歉,只是经历并整理了我未解答的问题。 – Nick 2011-11-07 14:31:50