Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: jpsoto on March 27, 2011, 09:08:04 PM



Title: Apache HTTPD Configuration for Bitcoin JS Remote
Post by: jpsoto on March 27, 2011, 09:08:04 PM
Dear friends,
I have just added a short wiki fragment with the proper configuration to access remotely Bitcoin daemon using a browser.

Thanks for a great piece of code: Bitcoin JS Remote.

Please, test and feedback:
https://en.bitcoin.it/wiki/Bitcoin-js-remote (https://en.bitcoin.it/wiki/Bitcoin-js-remote)



Title: Re: Apache HTTPD Configuration for Bitcoin JS Remote
Post by: tcatm on March 28, 2011, 08:58:56 PM
Great work! I'll add a link to the wiki on the project page.


Title: Re: Apache HTTPD Configuration for Bitcoin JS Remote
Post by: bitcoinex on March 29, 2011, 07:52:58 AM
Yes, it is useful to understand how daemon can be used


Title: Re: Apache HTTPD Configuration for Bitcoin JS Remote
Post by: jpsoto on March 31, 2011, 03:36:04 AM
@tcatm
thanks for adding my contribution.

I would like to propose you a tiny convenience improvement for BC JS Remote.

I am setting up BC JS Remote to access several instances of bitcoind running in the same box; more specifically a testnet-in-a-box configuration:
http://sourceforge.net/projects/bitcoin/files/Bitcoin/testnet-in-a-box/ (http://sourceforge.net/projects/bitcoin/files/Bitcoin/testnet-in-a-box/)

Using a fixed value for RPC.url in the settings.json file is a difficulty for multiple access, because there is no way to instruct Apache to proxy to/from every bitcoind instance.

My proposal is following behaviour; if the RPC.url field is undefined, it is automatically assigned to a value derived from the directory part of the URI. For instance,

Accessing with http://mydomain/jbc1 leads to a RPC.url value of "/jbc1/bitcoind/, and
accessing with http://mydomain/jbc2 leads to a RPC.url value of "/jbc2/bitcoind/

This allows us to setup different Proxy directives for the Apache webserver. For instance:
ProxyPass /jbc1/bitcoind/ http://localhost:19331/
ProxyPass /jbc2/bitcoind/ http://localhost:19332/

Is an interesting improvement for you?, could you code such a suggestion?

Also, I could pull a patch for BC JS Remote, my experience coding JS is limited but acceptable.


Title: Re: Apache HTTPD Configuration for Bitcoin JS Remote
Post by: tcatm on March 31, 2011, 03:53:37 AM
I think that's already possible. Try setting RPC.url to "bitcoind/" and it should append that to the path.


Title: Re: Apache HTTPD Configuration for Bitcoin JS Remote
Post by: jpsoto on April 01, 2011, 07:02:47 AM
@tcatm, you are right

Setting up RPC.url="bitcoind/" allows to configure Apache for multiple access. For instance, following Apache configuration

   AliasMatch   ^/jbc([0-9]?)(.*)$ your_prefer_pathabs_to_JSRemote_without_trailing_slash$2
   ProxyPass    /jbc/bitcoind/ http://localhost:8332/
   ProxyPass    /jbc1/bitcoind/ http://localhost:19331/
   ProxyPass    /jbc2/bitcoind/ http://localhost:19332/

allows following concurrent accesses:

   http://mydomain/jbc   .......... Access to a bitcoind listening the default rpc port (8332)
   http://mydomain/jbc1 .......... Access to another bitcoind listening a non-default rpc port (19331)
   http://mydomain/jbc2 .......... Access to another bitcoind listening a non-default rpc port (19332)

Another tip. Taking in account bitcoind talks only json (To-Be-Confirmed), ProxyPassReverse is not required.


Title: Re: Apache HTTPD Configuration for Bitcoin JS Remote
Post by: tcatm on April 01, 2011, 07:24:44 AM
ProxyPass should be enough. RPC is only JSON.


Title: Re: Apache HTTPD Configuration for Bitcoin JS Remote
Post by: jpsoto on April 02, 2011, 09:42:55 AM
Dear friends, ... Bitcoin JS Remote wiki has been updated to clarify several Apache configurations tips.

Please, test and feedback:
https://en.bitcoin.it/wiki/Bitcoin-js-remote