How to Set up Cloudflare DNS with DigitalOcean droplet

October 20, 2018 2k views
WordPress Networking DNS CDN Ubuntu 18.04 Ubuntu

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?

1 Answer
ApCoder123 October 20, 2018
Accepted Answer

Nevermind, I found a fix elsewhere. Answer from sdayman on the CloudFlare community forums:
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' );
Have another answer? Share your knowledge.