pull down to refresh

Setting Up BTCPay Server with Cloudflare BTCPay Server is a self-hosted, open-source cryptocurrency payment processor that allows you to accept Bitcoin and other cryptocurrencies securely. Integrating it with Cloudflare can enhance security, improve performance, and provide a user-friendly domain setup. Below is a step-by-step guide to setting up BTCPay Server with Cloudflare.
Prerequisites A server or VPS with BTCPay Server installed (e.g., via Docker or other methods). A domain name registered and managed through Cloudflare. Basic knowledge of DNS and server configuration. Step-by-Step Instructions
  1. Set Up Your Domain on Cloudflare Log in to your Cloudflare account and add your domain. Update your domain's nameservers to point to Cloudflare (this is done through your domain registrar). Once the domain is active on Cloudflare, proceed to configure DNS.
  2. Configure DNS Records In the Cloudflare dashboard, go to the DNS tab. Add an A record pointing to your BTCPay Server's IP address: Type: A Name: btcpay (or your desired subdomain, e.g., pay) Content: Your server's public IP address Proxy Status: Set to Proxied (orange cloud icon) for Cloudflare protection. If you're using IPv6, add an AAAA record with the same subdomain and your server's IPv6 address.
  3. Enable SSL/TLS Go to the SSL/TLS tab in Cloudflare. Set the SSL/TLS encryption mode to Full (Strict) for maximum security. Ensure your BTCPay Server has a valid SSL certificate (e.g., Let's Encrypt). If not, you can generate one during the BTCPay setup process.
  4. Update BTCPay Server Configuration If you installed BTCPay Server using Docker, update the environment variables in your docker-compose file: Set the BTCPAY_HOST variable to your domain or subdomain (e.g., btcpay.yourdomain.com). Restart the BTCPay Server container to apply changes: bash Copy Code docker-compose down
    docker-compose up -d
    Ensure your server is listening on ports 80 (HTTP) and 443 (HTTPS).
  5. Configure Cloudflare Page Rules (Optional) To force HTTPS and optimize performance, go to the Page Rules tab in Cloudflare. Create a rule for your BTCPay Server domain: URL: https://btcpay.yourdomain.com/* Settings: Forwarding URL: Redirect all HTTP traffic to HTTPS. Cache Level: Set to "Bypass" to avoid caching dynamic content.
  6. Test Your Setup Open your browser and navigate to your BTCPay Server domain (e.g., https://btcpay.yourdomain.com). Verify that the site is accessible, uses HTTPS, and is proxied through Cloudflare.
  7. Enable Security Features In the Security tab of Cloudflare, enable features like: Firewall Rules: Restrict access to your BTCPay Server to specific IPs or countries if needed. Bot Management: Protect against malicious bots. Rate Limiting: Prevent abuse by limiting requests. Tips Use Cloudflare's Zero Trust Access for additional security, allowing only authorized users to access your BTCPay Server. Regularly update your BTCPay Server to ensure you have the latest security patches and features. Monitor your Cloudflare analytics to track traffic and potential threats. By following these steps, you can securely and efficiently set up BTCPay Server with Cloudflare, ensuring a robust and user-friendly payment processing system.