
Deploy BTCPay Server on Your Own Server
Free, open-source & self-hosted, Bitcoin payment processor.
Want to deploy BTCPay Server on your server faster? Try Senate with one-command setup, automatic HTTPS and monitoring.
What is BTCPay Server?
BTCPay Server is a free, open-source & self-hosted bitcoin payment gateway. It allows self-sovereign individuals and businesses to accept bitcoin payments online or in person without any fees. This will deploy BTCPay Server with Bitcoin Full Node (with 50 GB pruning), Core Lightning Node, Spark Wallet and Ride The Lightning. Please note that features like SSH access and Onion service have been omitted to keep deployment simple. You may need to open the port `9735` in your firewall.
Self-Host BTCPay Server
Follow these steps to deploy on your own server.
Install Docker
Skip this step if Docker is already installed on your server.
curl -fsSL https://get.docker.com | sh
Configure
Customize the settings below. Defaults work for most cases.
General
Explorer
Database
Application
Bitcoin Node
Lightning Node
Ride The Lightning
Deploy
Copy the configuration and run it on your server.
services:
btcpayserver:
image: btcpayserver/btcpayserver:1.6.11
environment:
BTCPAY_BIND: 0.0.0.0:49392
BTCPAY_BTCEXPLORERURL: http://btcpayserver-nbxplorer:32838/
BTCPAY_BTCEXTERNALCLIGHTNINGREST: server=/clightning-rest/btc;macaroonfilepath=/etc/clightning_bitcoin_rest_certs/access.macaroon;macaroondirectorypath=/etc/clightning_bitcoin_rest_certs
BTCPAY_BTCEXTERNALRTL: server=/rtl/api/authenticate/cookie;cookiefile=/etc/clightning_bitcoin_rtl/.cookie
BTCPAY_BTCEXTERNALSPARK: server=/spark/btc/;cookiefile=/etc/clightning_bitcoin_spark/.cookie
BTCPAY_BTCLIGHTNING: type=clightning;server=unix://etc/clightning_bitcoin/lightning-rpc
BTCPAY_CHAINS: btc
BTCPAY_DEBUGLOG: btcpay.log
BTCPAY_DOCKERDEPLOYMENT: "true"
BTCPAY_EXPLORERPOSTGRES: User ID=postgres;Host=btcpayserver-postgres;Port=5432;Application Name=btcpayserver;MaxPoolSize=80;Database=nbxplorermainnet
BTCPAY_HOST: btcpayserver.your-domain.com
BTCPAY_NETWORK: mainnet
BTCPAY_POSTGRES: User ID=postgres;Host=btcpayserver-postgres;Port=5432;Application Name=btcpayserver;Database=btcpayservermainnet
BTCPAY_ROOTPATH: /
BTCPAY_UPDATEURL: https://api.github.com/repos/btcpayserver/btcpayserver/releases/latest
volumes:
- btcpayserver-data:/datadir
- btcpayserver-nbxplorer-data:/root/.nbxplorer
- btcpayserver-plugins:/root/.btcpayserver/Plugins
- btcpayserver-lightning-data:/etc/clightning_bitcoin
- btcpayserver-lightning-spark:/etc/clightning_bitcoin_spark
- btcpayserver-lightning-rtl-data:/etc/clightning_bitcoin_rtl
- btcpayserver-lightning-rest-certificates:/etc/clightning_bitcoin_rest_certs
depends_on:
- btcpayserver-postgres
- btcpayserver-bitcoind
- btcpayserver-lightning
btcpayserver-bitcoind:
image: btcpayserver/bitcoin:23.0
environment:
BITCOIN_EXTRA_ARGS: |+
rpcport=43782
rpcbind=0.0.0.0:43782
rpcallowip=0.0.0.0/0
port=39388
whitelist=0.0.0.0/0
maxmempool=500
prune=50000
BITCOIN_NETWORK: mainnet
BITCOIN_WALLETDIR: /walletdata
volumes:
- btcpayserver-bitcoind-wallet-data:/walletdata
- btcpayserver-bitcoind-data:/data
btcpayserver-lightning:
image: btcpayserver/lightning:v0.10.2
environment:
LIGHTNINGD_ALIAS: 3a5facc14bb1dbfa91c0cecf7e5c7d69
LIGHTNINGD_ANNOUNCEADDR: ""
LIGHTNINGD_CHAIN: btc
LIGHTNINGD_NETWORK: mainnet
LIGHTNINGD_OPT: |+
bitcoin-datadir=/etc/bitcoin
bitcoin-rpcconnect=btcpayserver-bitcoind
experimental-offers
LIGHTNINGD_PORT: "9735"
LIGHTNINGD_READY_FILE: /root/.nbxplorer/btc_fully_synched
volumes:
- btcpayserver-lightning-data:/root/.lightning
- btcpayserver-bitcoind-data:/etc/bitcoin
- btcpayserver-nbxplorer-data:/root/.nbxplorer
ports:
- $$cap_LIGHTNINGD_PORT:$$cap_LIGHTNINGD_PORT
depends_on:
- btcpayserver-bitcoind
btcpayserver-lightning-rest:
image: saubyk/c-lightning-rest:0.9.0
environment:
LIGHTNINGD_READY_FILE: /root/.nbxplorer/btc_fully_synched
NODE: btcpayserver-lightning:9835
PROTOCOL: http
volumes:
- btcpayserver-lightning-data:/root/.lightning
- btcpayserver-bitcoind-data:/etc/bitcoin
- btcpayserver-lightning-rest-certificates:/usr/src/app/certs
- btcpayserver-nbxplorer-data:/root/.nbxplorer
depends_on:
- btcpayserver-lightning
btcpayserver-lightning-spark:
image: shesek/spark-wallet:0.3.1-standalone
environment:
NETWORK: mainnet
SPARK_OPT: --no-tls -C /data/.cookie
volumes:
- btcpayserver-lightning-data:/etc/lightning
- btcpayserver-lightning-spark:/data
depends_on:
- btcpayserver-lightning
btcpayserver-nbxplorer:
image: nicolasdorier/nbxplorer:2.3.38
environment:
NBXPLORER_AUTOMIGRATE: "true"
NBXPLORER_BIND: 0.0.0.0:32838
NBXPLORER_BTCNODEENDPOINT: btcpayserver-bitcoind:39388
NBXPLORER_BTCRPCURL: http://btcpayserver-bitcoind:43782/
NBXPLORER_CHAINS: btc
NBXPLORER_NETWORK: mainnet
NBXPLORER_NOMIGRATEEVTS: "true"
NBXPLORER_POSTGRES: User ID=postgres;Host=btcpayserver-postgres;Port=5432;Application Name=nbxplorer;MaxPoolSize=20;Database=nbxplorermainnet
NBXPLORER_SIGNALFILESDIR: /datadir
NBXPLORER_TRIMEVENTS: "10000"
volumes:
- btcpayserver-nbxplorer-data:/datadir
- btcpayserver-bitcoind-data:/root/.bitcoin
depends_on:
- btcpayserver-postgres
btcpayserver-postgres:
environment:
POSTGRES_HOST_AUTH_METHOD: trust
volumes:
- btcpayserver-postgres:/var/lib/postgresql/data
btcpayserver-rtl:
image: shahanafarooqui/rtl:0.13.1
environment:
BITCOIND_CONFIG_PATH: /etc/bitcoin/bitcoin.conf
CONFIG_PATH: /root/.lightning/config
LN_IMPLEMENTATION: CLT
LN_SERVER_URL: http://btcpayserver-lightning-rest:3001/v1
LOGOUT_REDIRECT_LINK: /server/services
MACAROON_PATH: /etc/clightning_bitcoin_rest_certs
RTL_CONFIG_PATH: /data/
RTL_COOKIE_PATH: /data/.cookie
RTL_SSO: "1"
volumes:
- btcpayserver-lightning-data:/root/.lightning
- btcpayserver-bitcoind-data:/etc/bitcoin
- btcpayserver-lightning-rtl-data:/data
- btcpayserver-lightning-rest-certificates:/etc/clightning_bitcoin_rest_certs
volumes:
btcpayserver-data: {}
btcpayserver-nbxplorer-data: {}
btcpayserver-plugins: {}
btcpayserver-lightning-data: {}
btcpayserver-lightning-spark: {}
btcpayserver-lightning-rtl-data: {}
btcpayserver-lightning-rest-certificates: {}
btcpayserver-bitcoind-wallet-data: {}
btcpayserver-bitcoind-data: {}
btcpayserver-postgres: {}
Then run:
docker compose up -d
Access
Once started, access your app at http://localhost:80
Why Self-Host BTCPay Server?
Full Data Ownership
Your data stays on your servers. No third-party access.
No Monthly Fees
Pay only for your server. No per-seat or usage charges.
Complete Control
Customize, backup, and scale on your own terms.
Privacy & Compliance
Meet GDPR, HIPAA, or internal security requirements.
Technical Details
Docker Image
btcpayserver/btcpayserver:${BTCPAYSERVER_VERSION}Official Docs
docs.btcpayserver.orgWant to go faster?
Try Senate! Senate handles Docker, HTTPS, updates, and monitoring for you. Deploy any of our 300+ apps with a single command.
Install on any Linux server:
sh -c "$(curl -sSL https://get.senate.sh)"