Answer the question
In order to leave comments, you need to log in
How to configure nginx to serve different content to different subdomains and ports?
Good afternoon. There was a problem - I have a server with IP (conditionally) 185.189.20.55 and nginx is installed on it, two sites work on the same server, the first one listens on port 3000 and the second 3001. How can I write an nginx configuration file so that when accessing the example1 subdomain. alexdeg.ru came up with something that listens on port 3000, and with example2.alexdeg.ru, that on port 3001.
I set it up through the nginx documentation for a long time but already forgot. Now I'm going in and I can't figure it out. It seems that I do everything according to the documentation, but errors are pouring in or nothing works at all. I rarely set up proxies and therefore I don’t have much skill. Thank you for your help.
Answer the question
In order to leave comments, you need to log in
What you want is the most common nginx configuration option, it is issued for about every first link on the Internet. You need to make two server blocks with corresponding server_name
`s and locations with proxy_pass
`s on the required ports.
Relevant link - https://nginx.org/en/docs/http/ngx_http_proxy_modu...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question