title: NGinx config for redirecting domain
body: <p>I have 2 servers on my network:</p>
  
  <p>one linux machine (192.168.0.2) with a website listening on port 8181 for service1.domain.com
  one windows machine (192.168.0.3) with a website listening on port 8080 for service2.domain.com</p>
  
  <p>I want to set up an nginx reverse proxy so that I can route requests like so:</p>
  
  <pre><code>service1.domain.com --&gt; 192.168.0.2:8181 with host header service1.domain.com
  
  service2.domain.com --&gt; 192.168.0.3:8080 with host header service2.domain.com
  </code></pre>
  
  <p>I have tried with the following config:</p>
  
  <pre><code>### General Server Settings             ###
  
  worker_processes  1;
  
  events {
    worker_connections  1024;
  }
  
  ### Reverse Proxy Listener Definition  ###
  
  http {
   server {
    listen        80;
    server_name       service1.domain.com;
    location / {
     proxy_pass       http://192.168.0.2:8181;
     proxy_set_header     host service1.domain.com;
    }
   }
  server {
    listen        80;
    server_name       service2.domain.com;
    location / {
     proxy_pass       http://192.168.0.3:8080;
     proxy_set_header     host service2.domain.com;
    }
   }
  }
  </code></pre>
  
  <p>But that doesn't seem to work? </p>
  
  <p>Is there anything blindingly obvious that I might be doing wrong here?</p>