Question

How to bind IP address to domain?

Hi, I can add domain to my dropplet using virtual host, but how can I point my IP address to the domain, let’s say my domain is example.com, my IP address 111.111.111.111, now what I want is if I put 111.111.111.111 on browser, it will open example.com.

Thanks


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

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.

Hi @MrWorldWideWeb

Create another VirtualHost for your IP and redirect to your domain:

<VirtualHost *:80>
  ServerName 111.111.111.111
  Redirect permanent / http://example.com/
</VirtualHost>

I have the opposite issue, the droplet IP shows one of the site not the default one ;)

It seems I work it out, by creating virtual host with that IP address as a name, and example.com as the alias, pointing the same directory as example.com.