I’m currently trying to get my site to display its domain name (which I’ll call example.com) rather than the ip address associated with it. I’ve looked at tutorial after tutorial, but I haven’t come across a solution. I’m using Nginx with Wordpress in a docker container running on a digitalocean droplet.
Currently, I have three NS records with hostname set to my domain example.com, and they direct to ns1.digitalocean.com, ns2.digitialocean.com, etc. I can visit my site by typing in example.com, but it then displays the ip address, and I want it to display example.com instead.
I’ve tried the following:
1.) I’ve tried going into my nginx.conf file and changing the server_name variables to my hostname instead of the ip address, but this doesn’t change anything.
2.) I’ve tried navigating to my wordpress wp-config.php file and adding
define('WP_SITEURL', 'http://www.example.com'); define('WP_HOME', 'http://www.example.com');
but this causes a ‘too many redirects’ error. I’ve also tried it without the www, but that also produces a too many redirects error.
What am I doing wrong? Does anyone know how I can get my site to always display the hostname over the ip address? Any help would be appreciated.
This textbox defaults to using Markdown to format your 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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $200 of credit to try our products over 60 days!