How do I test a site I'm developing in a droplet?

Posted October 6, 2019 1.9k views

I’m using ssh to access my droplet. I can pull the code and develop, but how do I view my edits from a browser? What is the equivalent to spinning up the site locally and accessing

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.

Submit an Answer
1 answer


It would depend on the type of application that you are using but for example if you are developing a static HTML/CSS site, you could only install Nginx and it should all work out of the box:

If you are developing a node application, you could again use Nginx but use it as a reverse proxy:

Then once you have this setup, you can visit your droplet’s IP in your browser and you would be able to see your app.

Hope that this helps!

by Brennen Bearnes
Node.js is an open source JavaScript runtime environment for easily building server-side and networking applications. Node.js applications can be run at the command line but this guide focuses on running them as a service using PM2, so that they will automatically restart on reboot or failure, and can safely be used in a production environment.
  • Hi,

    What if we have multiple domains on the VPN? How do I test the second domain before I change the DNS poiting?

    • Hello,

      You can test its work by using your hosts file.

      You can edit the hosts file on your PC to bypass the DNS lookup and access the site on our servers through your main domain rather than the preview URL.

      This only affects your PC and visitors to your website will see the site as normal.

      The location of the file is as follows:

      • Windows PC: c:/windows/system32/drivers/etc/hosts

      Mac and Linux:


      Just open it up in your favorite text editor (e.g. Notepad) and add that line on the bottom:

      your_server_ip_here your_domain www.your_domain

      Once you have made the change, save the file then browse to your website as normal. Make sure to clear your browser cache first.

      You will see it served from your new server and will be able to test the full functionality of your website.

      To view the site on your existing host, just remove the line from your hosts file.

      Hope that this helps.

      • Thank you Bobby. Just confused here as I have limited tech knowledge.

        How will editing host on my local machine, make me view the files that are on my digital ocean server?

        • So I went and tried the solution you proposed and I have another question:

          The IP to my Droplet is (lets say) and I have a domain already pointed to it. The site is working and it up and running. Anyone can access that website.

          Now, I have added another domain that I have added through Vesta CPanel. I have not changed the DNS Zones in the domain control panel to point to this IP as yet. I have not created a subdomain or a host for this domain. I have uploaded all files, added a new DB and so on. Inorder to view this website – what is the IP I can mention in the host file? I tried entering – however; opens up 

          • Hi there,

            In order for this to work the website needs to be added to your server. For example if you are using cPanel, then you need to add the domain as an addon domain, or if you are using a plain server with Apache only, then you need to create the Apache virtual host for that website.

            Otherwise, your server would not know where to load the website files for this particular domain.

            Once you’ve tested the site then the only thing left to be done would be to change your DNS.


        • Hi there,

          No problem at all! This is just how the hosts file works, you can specify an IP and a domain name, and it makes your PC skip the DNS lookup and load the site from the IP that you’ve specified.

          Hope that this helps!