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?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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', '' );
define( 'WP_SITEURL', '' );