Hi,
I have 3 subdomains redirected via DNS to a public ipaddress, which is NAT'ed 1:1 to a ubuntu 14.0.4 vm on our private network.
This ubuntu VM has nginx installed in a reverse proxy configuration, which has to push (based on names) the requests to another nginx http server for the moment.
Domains are:
a.mydomain.com
b.mydomain.com
c.mydomain.com
I tried different approaches, but whatever I try the rev. proxy pushes all requests to first entry in the default file (which follows), instead of sending to proper upstream http server:
server {
listen 80;
server_name a.mydomain.com;
location / {
proxy_pass http://10.0.14.10:7070/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name b.mydomain.com c.mydomain.com;
location / {
proxy_pass http://10.0.14.10:80/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Now all goes to http://10.0.14.10:7070/ no matter what is passed (a.mydomain.com, b.mydomain.com or c.mydomain.com) , if I put http://10.0.14.10:80/; as first entry all will go to that.
Please tell me what is wrong with this simple configuration
Thanks
Regards
C.
I have 3 subdomains redirected via DNS to a public ipaddress, which is NAT'ed 1:1 to a ubuntu 14.0.4 vm on our private network.
This ubuntu VM has nginx installed in a reverse proxy configuration, which has to push (based on names) the requests to another nginx http server for the moment.
Domains are:
a.mydomain.com
b.mydomain.com
c.mydomain.com
I tried different approaches, but whatever I try the rev. proxy pushes all requests to first entry in the default file (which follows), instead of sending to proper upstream http server:
server {
listen 80;
server_name a.mydomain.com;
location / {
proxy_pass http://10.0.14.10:7070/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name b.mydomain.com c.mydomain.com;
location / {
proxy_pass http://10.0.14.10:80/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Now all goes to http://10.0.14.10:7070/ no matter what is passed (a.mydomain.com, b.mydomain.com or c.mydomain.com) , if I put http://10.0.14.10:80/; as first entry all will go to that.
Please tell me what is wrong with this simple configuration
Thanks
Regards
C.