2010-08-19 27 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