Domanda

Hi guys i have a problem. I work with php and node, php works with nginx listening port 80 and node works with the port 3000. I want add a subdomain that listen port 3000 a like media.mydomain.com but i could not. I tried with my website register domain and nothing happened and then with nginx in virtual host but show in console error because this port it is using.

nginx-php=mydomain.com

node=mydomain.com:3000 (tried add subdomain "media.fotogena.co") virtual host:

 server {
     server_name media.mydomain.com;
     listen   mydomain.com:3000;
     #i don't know that do!
}#show error port is being used

and had seen something like upstream but this assign port 80 to port 3000 but don't is the that me need

È stato utile?

Soluzione

If i understand what you want to do, you want a subdomain to use instead of the port 3000, for the subdomain to work you need it to listen on port 80, and proxy what ever comes to port 3000.

server {
  server_name sub.example.com;
  listen 80;
  location / {
    proxy_pass http://localhost:3000;
  }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top