Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stefr's avatar

How do I set these two servers up using private network

I'm using Forge (love it!) and Digital Ocean. On my first server (server 1) I have a laravel installation which only collects and processes data between two api's. This is working wonderful. I had a blast creating this with Eloquent. This laravel installation has no web output. I don't even have it setup to a domain, it just processes information and stores it in the database.

On another (soon to build) server (server 2) I have a admin website that needs to get some data from server 1. I would like to make this connection through the internal private network (for security). I want to create an API on server 1 to provide this data (in json) using the models I've created on this server. For example I would like to connect through internal ip adres http://111.222.333.444/api/get/1/2

Here are the questions: How do I setup server 1 so the outside world cannot connect to it? How do I setup server 1 so I can use the routes.php to create the api like in the example.

Hope anyone will share his thoughts!

0 likes
4 replies
bashy's avatar

You will need to speak to your hosting provider to give you a private cloud or private connection to your other server. They will be able to connect the two in a private network.

stefr's avatar

Thanks @bashy. But this is not the problem. Digital ocean provides a private network. So I already have an internal ip. I would like to know how I set this up so the internal ip will direct me to the 'public' folder on server 1.

bashy's avatar
bashy
Best Answer
Level 65

Oh I thought I read that you wanted to know that.

How do I setup server 1 so the outside world cannot connect to it?

If you want it to read via an internal IP, you will need to put that IP into the Nginx virtual host file

stefr's avatar

Thanks, I will give that a try.

Please or to participate in this conversation.