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

sirexzib's avatar

Should you have a second server for your API?

I am currently running a website with over 14 thousand users where we have about 8 thousands unique logged in users every week.

We are also in the middle of building an API so people can grab data from us/their accounts.

Now my question is, should you have your API on a second or on the main server? What I mean with this is that we don't want to slow down our main server where the website is running incase the API gets a lot of requests.

Is this something we should do or is it recommended to use something like digital ocean load balancing instead?

0 likes
1 reply
andreasbakir's avatar

I would say either rent a really powerful VPS and run the API and the frontend on that server or split them up. To be honest I prefer using one server because if you use 2, you will have to do allot of tweaking to protect the site/api for xss (Cross Site Scripting) or if you use Laravel Passport and authenticate every request with a token that shouldn't be a problem.

I host my sites on a vps I rent at contabo.com I don't know how they do it but they have ridiculously low pricing for their vps's (https://contabo.com/?show=vps) you can rent a vps with a hexa core and 24GB of RAM with unlimited traffic and 600GB of SSD space for just €15 a month! And i believe that, that server is strong enough for your project.

And for configuration try http://serverpilot.io it is a great free service!

Please or to participate in this conversation.