即使在这个论坛中,我也至少找到了十几个关于这个错误的条目,在外面还有很多。所有人基本上都在说在 <Directory></Directory>
中,我有“拒绝所有”指令,没有“允许”指令。
我无法编写固定目录来匹配,因为它是由后端 tomcat 服务器动态创建的。
当我输入“myUrl/test/request/user1/1234567890/download”时,我得到了
403 Forbidden: You don't have permission to access /test/request/user1/1234567890/download.
httpd错误日志显示:
[error] [client xxx.xx.xx.xxx] client denied by server configuration: /data/test, referer: myUrl/test/request/user1/1234567890
以“test”开头的部分由后端tomcat创建,其中“user1”和“1234567890”有所不同,其他部分目录结构保持不变。
在我的 httpd.conf 中,我有:
<VirtualHost *:80>
DocumentRoot /data
---
---
RewriteRule ^/test - [L]
---
</VirtualHost>
我该如何解决这个问题?即使我创建了一个不同的文档根目录,我也需要一个正则表达式。在外面的某个地方,我试过这个:
<Directory "/data/test/request/*/*/download">
Options -Indexes -FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
但没有成功。
我正在使用“ajp”与后端 tomcat 通信,并且有必要的模块,我可以远程登录后端 tomcat 服务器(在 8009 上)。所以应该不是ajp通讯问题。
上面 url 中的“测试”部分实际上是 tomcat 的/webapps 目录中的“上下文”。该“测试”上下文中的所有者是 tomcat,但我为所有人添加了读取权限。
最佳答案
首先,我必须为“/”“全部拒绝”
Directory
Deny from all
/Directory
只有这样“/data”才“Allow for all”
Directory /data
---
---
Allow from all
/Directory
然后我在
VirtualHost *:80
/VirtualHost
成功了!
关于regex - 客户端被 tomcat 的服务器配置拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13785591/