dashed-slug.net › Forums › General discussion › How to "connect RPC API on a different machine than that of your WordPress" › Reply To: How to "connect RPC API on a different machine than that of your WordPress"
Generally there are two difficulties:
1. Make sure that the firewalls on the wallet server allow incoming TCP connections to the wallet’s RPC API. Before trying to connect using WordPress, it might be worth trying to connect using bitcoin-cli or even nc. Check your firewalls, ip filters, etc.
2. Once you get the connection to work, the next problem is that it’s not encrypted. You can’t use SSL as it was removed from bitcoind. You can set up an ssh tunnel to encrypt the connection, but the difficulty here is to maintain the tunnel even after server restart. Have a look here to get an idea of what’s involved: https://gist.github.com/EnigmaCurry/bdd9fd28d7a73fe52eb4 The first step is to open the tunnel using ssh from your WordPress host to the remote wallet’s socket. Then make the plugin connect to the local port instead of the remote one. Once you get this to work, you can setup a unix cron job that checks if the tunnel exists and if not, recreate it. In the script above you can see how to use netstat to check if the port is open.
Best of luck!