【发布时间】:2013-08-24 12:57:13
【问题描述】:
我需要通过 Apache VirtualHost 子域以及授权连接我的 Mercurial 服务器 cgi 脚本。
我的 apache 在 80 和 91 上运行。 Apache 通过
为 Mercurial 提供服务C:\wamp\bin\apache\Apache2.2.21\cgi-bin\hgweb.cgi 并且可以通过
访问http://my.com/cgi-bin/hgweb.cgi 和 http://localhost/cgi-bin/hgweb.cgi
一切都很好,它在那里完美地发挥了作用。我的目标是将其子域设置为:
没有尾随 cgi-bin/hgweb.cgi
我已获得以下 URL 以使用下面给出的配置:
http://hg.my.com/cgi-bin/hgweb.cgi
...但它无法正确访问 css 和图像(与上述完美服务不同)
到目前为止我的配置:
ScriptAlias /hg "/cgi-bin/hgweb.cgi"
<VirtualHost *:80>
ServerName hg.my.com
ServerAlias hg.my.com
#ScriptAlias / "/cgi-bin/hgweb.cgi"
# <Directory />
# Order Deny,Allow
# Allow from all
# </Directory>
# ProxyPass /stylesheets !
# ProxyPass /javascripts !
# ProxyPass /images !
ProxyPassMatch ^.*/static(/.*\.css)$ http://localhost:91/cgi-bin/hgweb.cgi/static/$1
ProxyPassMatch ^.*/static(/.*\.js)$ http://localhost:91/cgi-bin/hgweb.cgi/static/$1
ProxyPassMatch ^.*/static(/.*\.png)$ http://localhost:91/cgi-bin/hgweb.cgi/static/$1
ProxyPassMatch ^.*/static(/.*\.gif)$ http://localhost:91/cgi-bin/hgweb.cgi/static/$1
ProxyPreserveHost On
ProxyPass / http://localhost:91/cgi-bin/hgweb.cgi
ProxyPassReverse / http://localhost:91/cgi-bin/hgweb.cgi
<Proxy *>
#DirectoryIndex hgweb.cgi
#ScriptAlias / /hgweb.cgi
# # Order Allow,Deny
# # Allow from all
Order Deny,Allow
Allow from 127.0.0.1
AuthUserFile C:\wamp\.htpasswd
AuthName "Please Log In"
AuthType Basic
require user admin
require user dev
</Proxy>
</VirtualHost>
显然,我使用的是久负盛名的 google-trial-and-error 方法,在这里我已经超出了我的深度。
因此,我精力充沛的自我无意识的自力更生决心,否则似乎很管用,现在已经筋疲力尽,对手头的问题充满敌意——带着帽子,我来到这里,问:
“兄弟,你能不能省点钱?”
【问题讨论】: