How to Set up Cloudflare DNS with DigitalOcean droplet?

I am trying to set up my domain (DNS on Cloudflare) to point to a DigitalOcean droplet, but I can’t seem to get it to work properly. I have an Ubuntu Droplet, running WordPress, and on Cloudflare, I have configured an A record to point to the IP address of my droplet. When I try to access it, I get a 521 Error. If I turn the Cloudflare CDN off (grey cloud), the domain takes me to the droplet, but shows the IP address in the browser. How do I configure both my DNS and droplet to have the DNS on Cloudflare pointing to the droplet?

Was your domain working before you added it to Cloudflare? Having the IP address show up in the browser indicates a problem with your server configuration. You probably need to have Wordpress configured to use your domain for the URL. Add these two lines to your wp-config.php file with the appropriate URL:

define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );
3 Likes

Thanks @sdayman. This fixed my problem.

1 Like

This topic was automatically closed after 31 days. New replies are no longer allowed.