How to enable test custom domain

Used this tutorial and created custom domain name for testing. But opening in browser shows page not found, only wne I use it works. Do I have to use officially registered domain paid name? Or I just have to put it in /var/www as subfolder?

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.

Ok, thanks

HI @rulet,

You can use a domain that hasn’t been registered however you’ll need to edit the host file on your local computer to actually see it.

Let me give you some explanation what a hosts file is

First of all, the hosts file is a relic of the past. In the early days of the internet, the file was used to link domain names to certain IP addresses i.e. to ‘resolve’ them. For example, the hosts file made sure that the computer knew what IP address was meant by Therefore, the hosts file used to contain a long list of these hosts and their special addresses. The influence of the term ‘host’ is still noticeable today when you speak of ‘hosting a website’.

This means you have actually say to your computer the domain to load from the IP of your droplet. That way you’ll be able to load the content of your website without even having a registered domain.

How to change the hosts file in Windows XP, 7, 8, and 10

  • Find the entry ‘Editor’ in the start menu and right-click on it. Select ‘Run as an administrator’.
  • In the editor, go to the menu item ‘Open’ which you’ll find under ‘File’.
  • Open the ‘hosts’ file in Windows Explorer using the path C:\Windows\ System32\drivers\etc\hosts.
  • You can now edit the hosts file.

How to change the hosts file on your Mac

  • Select the tab ‘Go to’ in the upper start bar and click on ‘Go to folder’.
  • In the new dialog box, enter the following file path /private/etc/hosts. Then click on ‘Open’.
  • The folder containing the ‘hosts’ file will then open. Double-click on it to open the file’s text editing.

How to change the hosts file in Linux/Ubuntu

  • Depending on which version of the operating system you have as well as your personal choice, you will have one or more of the following default terminal programs installed: Unity, KDE, Xfce, LXDE, GNOME Shell, MATE.
  • Open the corresponding editor (usually via ‘Applications’ > ‘Accessories’ > ‘Terminal’).
  • Enter the following command: sudo nano /etc/hosts. The sudo prefix gives you the necessary root rights. The hosts file is a system file and is especially protected in Ubuntu.
  • You can then edit the hosts file with your text editor or terminal.

Regards, KDSys