我有一台运行OS X Server 5.1.7的Mac Mini。 我有一个服务运行本地访问通过http://127.0.0.1:3000/ask (无需身份validation),我想使其可用于外部,但使用OS X服务器目录进行身份validation。
因此,在网站部分,我创build了一个名为intranet.mydomain.com的新网站,只有“Intranet用户”(我创build的一个组)才能访问。
这样做后,我尝试访问https://intranet.mydomain.com ,它要求input用户名和密码,并且与“Intranet用户”一部分用户的凭证一起使用。
现在,要设置反向代理,我转到该文件
/Library/Server/Web/Config/apache2/sites/0000_127.0.0.1_34543_intranet.mydomain.com.conf
并添加以下内容:
ProxyPass /询问http://127.0.0.1:3000/ask
ProxyPassReverse /询问http://127.0.0.1:3000/ask
Directory节点之后。
现在,当访问https://intranet.mydomain.com/ask时 ,我到达了内部服务,但是没有请求authentication。 这应该是好的,我相信,因为在XMLconfiguration中只有Directory节点configuration了authentication:
<Directory "/Library/Server/Web/Data/Sites/intranet.mydomain.com"> Options All -Indexes -ExecCGI -Includes +MultiViews AllowOverride None <IfModule mod_dav.c> DAV Off </IfModule> <IfDefine !WEBSERVICE_ON> Require all denied ErrorDocument 403 /customerror/websitesoff403.html </IfDefine> AuthType Digest AuthName "Realm ID 75040558" <Limit PUT DELETE PROPPATCH PROPFIND MKCOL COPY MOVE LOCK UNLOCK> Require no-user </Limit> <Limit GET HEAD OPTIONS CONNECT POST> Require group memberusers </Limit> <IfDefine !WEBSERVICE_ON> Require all denied ErrorDocument 403 /customerror/websitesoff403.html </IfDefine> </Directory>
所以,为了使它成为全局的(对于文件系统和不在文件系统中的path),我将Directory节点改为位置节点,如下所示:
<Location "/"> Options All -Indexes -ExecCGI -Includes +MultiViews AllowOverride None <IfModule mod_dav.c> DAV Off </IfModule> <IfDefine !WEBSERVICE_ON> Require all denied ErrorDocument 403 /customerror/websitesoff403.html </IfDefine> AuthType Digest AuthName "Realm ID 75040558" <Limit PUT DELETE PROPPATCH PROPFIND MKCOL COPY MOVE LOCK UNLOCK> Require no-user </Limit> <Limit GET HEAD OPTIONS CONNECT POST> Require group memberusers </Limit> <IfDefine !WEBSERVICE_ON> Require all denied ErrorDocument 403 /customerror/websitesoff403.html </IfDefine> </Location>
这样做后,访问我的域的路由,我被要求authentication,我可以login。 但是,访问pathhttps://intranet.mydomain.com/ask我被要求进行身份validation(所有的好!),但它不接受任何有效用户的用户名/密码(注意,它适用于/但不适用/ask )。
任何想法为什么?
在将Directory更改为Location之前,以下是我的完整configuration文件:
<VirtualHost 127.0.0.1:34543> ServerName https://intranet.mydomain.com:443 ServerAdmin [email protected] DocumentRoot "/Library/Server/Web/Data/Sites/intranet.mydomain.com" DirectoryIndex index.html index.php default.html CustomLog /var/log/apache2/access_log combinedvhost ErrorLog /var/log/apache2/error_log <IfModule mod_ssl.c> SSLEngine Off SSLCipherSuite "HIGH:MEDIUM:!MD5:!RC4" SSLProtocol -all +TLSv1 +TLSv1.1 +TLSv1.2 SSLProxyEngine On SSLCertificateFile "/etc/certificates/intranet.mydomain.com.A86175C9AFAC45AA2D0D590A8B94ACC1455519F8.cert.pem" SSLCertificateKeyFile "/etc/certificates/intranet.mydomain.com.A86175C9AFAC45AA2D0D590A8B94ACC1455519F8.key.pem" SSLCertificateChainFile "/etc/certificates/intranet.mydomain.com.A86175C9AFAC45AA2D0D590A8B94ACC1455519F8.chain.pem" SSLProxyProtocol -all +TLSv1 +TLSv1.1 +TLSv1.2 SSLProxyCheckPeerCN off SSLProxyCheckPeerName off </IfModule> <Directory "/Library/Server/Web/Data/Sites/intranet.mydomain.com"> Options All -Indexes -ExecCGI -Includes +MultiViews AllowOverride None <IfModule mod_dav.c> DAV Off </IfModule> <IfDefine !WEBSERVICE_ON> Require all denied ErrorDocument 403 /customerror/websitesoff403.html </IfDefine> AuthType Digest AuthName "Realm ID 75040558" <Limit PUT DELETE PROPPATCH PROPFIND MKCOL COPY MOVE LOCK UNLOCK> Require no-user </Limit> <Limit GET HEAD OPTIONS CONNECT POST> Require group memberusers </Limit> <IfDefine !WEBSERVICE_ON> Require all denied ErrorDocument 403 /customerror/websitesoff403.html </IfDefine> </Directory> ProxyPass /ask http://127.0.0.1:3000/ask ProxyPassReverse /ask http://127.0.0.1:3000/ask </VirtualHost>