Run two services in the same domain on separate ports

Asked

Viewed 718 times

2

I need to configure an application that has two different services running on port 80 and another on 8080, but in the same domain. I ask you if it’s possible and how could I set you up this way?

Example:

meuunicodominio.com.br:80 way: /var/www/appfrontend

meuunicodominio.com.br:8080 way: /var/www/appbackend

The issue for this feat is the use of two technologies, in 80 PHP wheel and 8080 Node.js wheel, I have no option to create subdomains or add another domain, at most I can use the machine IP to point the backend.

  • no access to modify Nginx configuration is not possible.

  • I have root access to the server. The problem that I can’t use another domain, so I have to manage with the same using different ports for two apps.

1 answer

3


In the documentation there are examples of how to configure: http://nginx.org/en/docs/http/server_names.html

Configuration example:

server {
    listen       80;
    server_name  foo.bar  www.foo.bar;
    root         /var/www/foo.bar/
}

server {
    listen       8080;
    server_name  bar.foo  www.bar.foo;
    root         /var/www/bar.foo/
}
  • Thanks buddy, it worked!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.