How do I setup private websites.

I am setting up a database and for that I want to use a webinterface. I do not want that interface to be accessible from the WAN. Is there a way to make a VPN that I use to first login to the server that gives me access to the webinterface?

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 @davidSenseIT,

Yes, there is a good way to do it. You’ll need to set up the VPN and then block all access to your interface except your VPN’s IP address. Firstly, you’ll need to configure your VPN, I’ll recommend using OpenVPN. DigitalOcean has a pretty good tutorial on how to actually configure it and use it afterward:

OpenVPN is a full-featured, open-source Secure Socket Layer (SSL) VPN solution that accommodates a wide range of configurations. In this tutorial, you will set up an OpenVPN server on an Ubuntu 18.04 server and then configure access to it from Windows, macOS, iOS and/or Android. This tutorial will keep the installation and configuration steps as simple as possible for each of these setups.

Once you’ve done it, then you can go ahead and disable the access for your application, except of course the IP of your newly configured VPN.

Regards, KDSys

If there is somebody else looking at this I also needed to add a firewall rule to get access to my private website from the VPN.

sudo ufw allow in on tun0 to any port 5000

5000 need to be changed to the port you use.

I did it this way. But it was a lot of work. I also got recommended to simply put a firewall rule for that port just for requests from your machine. Not as safe probably. But you could turn it on and off every time you used it. But I am happy with my VPN solution now when it is in place. Thank you.