我们只希望build立一个网站来进行演示,我们可以:
我们似乎已经达到了2和3,但是1并没有像我们想象的那样工作,我们的用户不断获得HTTP基本authentication用户名和密码的重新authentication,即使他们已经被authentication,并且正在进入不同的页面网站。 我们从日志中注意到,在访问某些资产时他们会收到以下错误消息:
[Tue Jun 09 10:50:03.442834 2015] [access_compat:error] [pid 5740:tid 140705259312896] [client 78.52.242.163:62774] AH01797: client denied by server configuration: /var/www/docroots/stage/lib/yui/build/moodle-core-checknet/assets/checknet.txt, referer: http://stage.example.org/mod/scorm/player.php
这是我们的Apache vhost:
<VirtualHost *:80> ServerName stage.example.org DocumentRoot /var/www/docroots/stage <Directory /var/www/docroots/stage> Options Indexes FollowSymLinks MultiViews AllowOverride None # Only visible on Office network or anyone with a valid password. AuthType Basic AuthName "Authorisation Required" AuthUserFile "/var/www/htpasswd" Require valid-user Order allow,deny Allow from 202.161.24.210 127 ::1 Satisfy any </Directory> </VirtualHost>
我们正在CentOS 7上运行Apache 2.4.6。我们的configuration是否正确? 看来我们的configuration对于/var/www/docroots/stage的顶层文件以及直接在其下的子目录下的其他图像,css和javascript文件/var/www/docroots/stage ,但是它可能会忘记HTTP Auth经过一定数量的子目录? SELinux处于宽容模式。
没有完整的错误信息(我期望模块和IP地址),这是一个猜测,但是你混合来自Apache 2.4中的两个不同模块的指令,mod-authz-core的Require指令和“legacy”指令Allow和Order from mod-access-compat,可能不能很好的堆叠。
你可以尝试更换线条
Order allow,deny Allow from 202.161.24.210 127 ::1
随着以下
Require ip 202.161.24.210 127 ::1/128
已经存在Satisfy any应该符合你的要求。
你的第三个要求:
演示站点的某些部分将需要对自己发出REST请求…
您可能没有像预期的那样从回送地址访问服务器,但可以使用类似于http://api.example.com/rest?的FQDN进行configurationhttp://api.example.com/rest? 而是源自服务器的公共IP地址。
你可以添加服务器的公共IP地址,但是从Apache 2.4更容易解决; 如果满足以下任一条件,则本地提供者允许访问服务器:
所以,而不是列出循环回IP地址使用:
Require valid-user # Office Gateway: Require ip 202.161.24.210 # API access from this host: Require local # Only one or more of the above needs to match: Satisfy any