Nodejs and nginx - instances /subdomains limit

December 3, 2014 2.7k views

Hello , i am very pleased with the digital ocean service in general and i played around with many one klick nodejs and nginx setups in the past weeks.

I am just struggeling a bit with nginx proxy configuration but i am sure i will get used to it in the near future.

My question is about is there a limit with nodejs services and nginx on one dropplet
or is there a recommendation or best practice of how many instances i could use and is it appropriate to use different dropplets for an API endpoint and the frontend ?

for example:
application 1

Is domain validation an alternative to a "real" certificates, because +wildcard certificates are really expensive

Thanks a lot

2 Answers

Nginx itself shouldn't have any limitations on the number of Node apps you proxy through it. For each app, you'll just need an Nginx server block similar to this:

server {
    listen 80;


    location / {
        proxy_pass http://localhost:{YOUR_PORT};
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

The main concern would be the general load on the server and the fact that by putting them all on one host, one app could potentially bring the rest down. Generally, there are a number of benefits to breaking separate services out onto separate hosts. Being able to scale up a single service on demand can be useful. One exception to that is that Node is a single-threaded process. So unless you are spawning some kind of worker processes, running a single node app on a multi-core server will lead to underused resources.

Have another answer? Share your knowledge.