centOS nginx reverse proxy multiple servers question

Issues related to configuring your network
Post Reply
linux_guy
Posts: 27
Joined: 2016/09/25 17:56:44

centOS nginx reverse proxy multiple servers question

Post by linux_guy » 2018/01/06 03:57:15

hi!
I can't seem to figure out my setup. I was wondering if anyone could help me,
This is my setup of my server and 3 virtual machines:

router
physical server - esxi
---vm - Centos7 - nginx Reverse Proxy
---vm - Windows Server2012 - website1 .com
---vm Windows Server2012 - website 2 .com


currently, i got my reverse proxy working for 1 domain, if i add the second domain to the nginx.conf file. the second website won't work
doesn't matter which website, i can get them working one at a time,, but as soon as i add my other server in the .conf file, the second domain wont work

can someone take a look at my /etc/nginx/nginx.conf file, maybe you can see what i am doing wrong

Code: Select all


# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {



  server {
    listen 80;
    server_name svr1;         
    location    /  {
        proxy_set_header     x-real-IP                $remote_addr;
        proxy_set_header     x-forwarded-for          $proxy_add_x_forwarded_for;
        proxy_set_header     host                     $host;
        proxy_pass           http://192.168.1.104:80;
    }
   
   }



  server {
    listen 80;
    server_name svr2;         
    location    /  {
        proxy_set_header     x-real-IP                $remote_addr;
        proxy_set_header     x-forwarded-for          $proxy_add_x_forwarded_for;
        proxy_set_header     host                     $host;
        proxy_pass           http://192.168.1.105:80;
    }
   
   }




Post Reply