
主要是透過反覆試驗,我創建了下面的 Apache 設定檔。
它的目的是允許 localhost:8002 上的伺服器和透過 WSGI 的 trac 伺服器共用 LDAP 伺服器,並且看起來位於同一網域/連接埠上。
這些規則是獨立運作的,但不是並行的。
ProxyPass
特別是,只有/ProxyPassReverse
行被註解掉時,trac WSGI 才會正確服務。如果沒有重定向,位於 localhost:8002 的伺服器顯然不會對應到傳出 8022 連接埠。
我假設目錄、代理和位置規則的組合是我的問題的解決途徑 - 或者可能是它們的順序?
WSGIDaemonProcess trac stack-size=524288 python-path=/usr/lib/python2.5/site-packages
WSGIScriptAlias /trac /home/web/foo/parts/trac/tracwsgi/cgi-bin/trac.wsgi
<VirtualHost foo.bar.com:8022>
ServerName foo.bar.com
ServerAlias foo.bar.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyPass / http://localhost:8002/VirtualHostBase/http/foo.bar.com:8022/foo/VirtualHostRoot/
ProxyPassReverse / http://localhost:8002/VirtualHostBase/http/foo.bar.com:8022/foo/VirtualHostRoot/
<Directory "/home/web/foo/parts/trac/tracwsgi/cgi-bin">
WSGIApplicationGroup %{GLOBAL}
Options +Indexes FollowSymLinks
AllowOverride None
Allow from all
Order allow,deny
</Directory>
<Location "/trac">
AuthBasicProvider ldap
AuthType Basic
AuthzLDAPAuthoritative off
AuthName "Login"
AuthLDAPURL "ldap://127.0.0.1:389/dc=foo-bar,dc=org?uid"
AuthLDAPBindDN "cn=admin, dc=foo-bar, dc=org"
AuthLDAPBindPassword secret
require valid-user
</Location>
</VirtualHost>
答案1
添加:
ProxyPass /trac !
在 ProxyPass 之前為「/」。
看:
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass
您也缺少 WSGIProcessGroup 指令。該 Trac 執行個體不會在您建立的守護程序模式程序中執行。看: