Answer the question
In order to leave comments, you need to log in
How to bind a different domain depending on the server port?
Hello, The
question is as follows: I
have a dedicated server with conditional ip - 127.0.0.0
On port 3000 the React application is located
On port 8000 there is an API on Node.js
Everything is up and running,
Is there any way to bind the address 127.0.0.0:3000 to the domain, and 127.0.0.0:8000 to the subdomain?
Or implement it like this:
127.0.0.0:3000 - domain/
127.0.0.0:8000 - domain/api/
PS Server on Ubuntu. I tried to set up Nginx, but I'm not sure I did everything right, so I'm waiting for any ideas and suggestions.
Answer the question
In order to leave comments, you need to log in
For this, a proxy was invented.
/etc/nginx/sites-enabled/default
server {
listen 80;
server_name domain.ru
location / {
proxy_pass http://127.0.0.1:3000;
}
location /api {
proxy_pass http://127.0.0.1:8000;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question