Question

Website preview

Posted February 12, 2021 103 views
NginxConfiguration Management

I have set up a new droplet on Ubuntu 20.04 (LTS) x64 and have successfully installed the nginx mysql php lemp stack. Got two websites working on it and I have cloned the git repo for another ready to go live. I would like to test this one to make sure all is working ok before I update the nameservers. Is it possible to preview it in a browser somehow without changing the default site settings. To be honest I tried changing that and browsed to the IP of the droplet and it didn’t work. Any ideas? Thanks in advance.

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.

×
1 answer

Hello, @lukep11a

You can simply edit the hosts file locally on your PC and server the website content from the DigitalOcean droplet.

The location of the file on Window / MacOs are:

  • Windows PC c:/windows/system32/drivers/etc/hosts
  • Mac OSX /private/etc/hosts

You can open the file in any text editor like Wordpad, Notepad and add the following line in the file:

DropletIP domain.com www.domain.com

On Windows, you need to run Wordpad or Notepad with administrator permissions (right-click -> run as administrator).

On MAC the best way to edit it is using terminal and typing “sudo nano /etc/hosts”, then adding the line and pressing Ctrl+X.

Submit an Answer