I currently have a AngularJS application running on my virtual private server. To run this I'm using NGINX, Node and 'http-server' and pm2 to keep everything running.
So I start my backend using for example 'node server.js' (port 3000) and I setup a second process of 'http-server' (which I think runs on port 8080) in the public folder.
This is the configuration of my NGINX:
server {
listen 80;
server_name mywebsite.be;
location /{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:3000/;
}
}
Now I would like to setup a second application which is made with Angular (2). I'm trying to also run my backend with node on port 3001 and then starting http-server on port 8081.
How should I configure my NGINX?
Best Answer
Just add a second location with the correct proxy_pass directive (based on your configuration):
You can match on location or if you wish, on a second diffrent domain.