D
D
devianneabc2019-12-12 15:23:05
Nginx
devianneabc, 2019-12-12 15:23:05

Setting location for 2 domains on the same ip?

Hello, I ran into the need to configure nginx as a reverse proxy. The situation is one white ip, to which 2 domains are attached. In addition to nginx, there are 2 backend servers running on 80
, it is necessary that nginx listen to port 80 and proxy, depending on the url - the domain name (for example, roga.com; kopita.org) to the desired server on the local network. Ie, in fact, I don’t know how to set a condition for proxying in the location.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
latush, 2019-12-12
@devianneabc

server {
listen 80;
server_name roga.com;
location / {
proxy_pass http://local_roga_com_ip;
}
}
server {
listen 80;
server_name kopita.org;
location / {
proxy_pass http://local_kopita_org_ip;
}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question