如何为Couchapp配置Apache代理?

时间:2012-06-14 11:34:08

标签: apache proxy couchdb httpd.conf couchapp

我想通过 Ubuntu 10.04.1 上的 Apache Webserver 2.2.14 实现代理。对于 Couchdb 1.0.1 上的Couchapp,我对此没有经验。代理还应该重定向到另一个couchdb数据库和Apaches www-path中的其他一些路径。目标是调用sub.something.de上的Couchapp(index.html)。

我的问题是:

  1. 它有效,但有更聪明的方法吗?我自己的方式像一个解决方法一样找我。
  2. 问题是,当我使用couchdb-api进行注销时,我会从Apache登录另一个对话框。登录后,我可以退出;)问题是,我要求注销的uri看起来像_:_ @ sub.something.de,这与我的代理配置不匹配。解决方案是什么?
  3. 这是我的httpd.conf配置:

    <VirtualHost *:80>
     DocumentRoot "/var/www/Something"
     ServerName something
     ServerAlias sub.something.de
    
     AllowEncodedSlashes On
     ProxyRequests Off
     ProxyPreserveHost Off
     ProxyVia On
     KeepAlive Off
    
     <Proxy *>
      AuthType Basic
      AuthName "Something Login"
      AuthUserFile /home/user/.couchdb_htpasswd
      Require valid-user
    
      Order deny,allow     
      Deny from all
      Allow from 127.0.0.1
      Satisfy Any
     </Proxy>   
    
     ProxyPass /something_data http://localhost:5984/something_data/ nocanon
     ProxyPass /data http://localhost:5984/something/_design/prototype/data nocanon
     ProxyPass /css http://localhost:5984/something/_design/prototype/css nocanon
     ProxyPass /vendor http://localhost:5984/something/_design/prototype/vendor nocanon
     ProxyPass /js http://localhost:5984/something/_design/prototype/js nocanon
     ProxyPass /font http://localhost:5984/something/_design/prototype/font nocanon
     ProxyPass /php http://localhost/dev/something/php nocanon
     ProxyPass /uploads http://localhost/dev/something/uploads nocanon
     ProxyPass /_uuids http://localhost:5984/_uuids nocanon
     ProxyPass /_session http://localhost:5984/_session nocanon
     ProxyPass /_users http://localhost:5984/_users nocanon
    
     ProxyPass /_users !
     ProxyPass /_uuids !
     ProxyPass /_session !
     ProxyPass /php !
     ProxyPass /uploads !
     ProxyPass /font !
     ProxyPass /data !
     ProxyPass /css !
     ProxyPass /vendor !
     ProxyPass /js !
     ProxyPass /something_data !
    
     ProxyPass /  http://localhost:5984/something/_design/prototype/index.html nocanon
     ProxyPassReverse / http://localhost:5984/something/_design/prototype/
     RequestHeader unset Authorization
    
     ErrorLog "/home/user/logs/couchdb_error_log"
     CustomLog "/home/user/logs/couchdb_access_log" common
    </VirtualHost>
    

    THX

1 个答案:

答案 0 :(得分:0)

在couch.js中设置urlPrefix的值

#vi /etc/httpd/conf/httpd.conf
ProxyPass /_db/  http://localhost:5984/
ProxyPassReverse /_db/ http://localhost:5984/


#vi  /usr/share/couchdb/www/script/couch.js
CouchDB.urlPrefix = '/_db/';