Answer the question
In order to leave comments, you need to log in
How to make nginx proxy_pass to another server?
Dear, please tell me how to do this using nginx:
1. Public server
server subnet:
2. Server No. 1
3. Server No. 2
Server No. 1 is available at "public_server.ru/"
Server No. 2 is available at "" public_server.ru/ location"
Approximately according to this scheme, you need to display the server in the public.
There is a proxy_pass in the nzhniks, I found all sorts of such functions on the Internet:
location /name/ {
proxy_pass http://127.0.0.1/remote/;
}
Answer the question
In order to leave comments, you need to log in
Tax. See.
The nginx config structure is quite simple.
The main level is a file. It stores a certain set of settings, one can be included (included) from the other. There is the first file from which reading of all configuration begins.
The second level is the context or section of the config file. This is a certain area that will be affected by those settings that are inside. The context is indicated by "{}". The main contexts you care about are server and location
The third level of abstraction is the parameters themselves.
In your case, you need to insert two locales into the context of your server and make a proxy pass in each of them
server {
location / {
proxy_pass http://server1/;
}
location /location2/ {
proxy_pass http://server2/;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question