title: Nginx load balance on server with multiple domains
body: <p>I haven't seen anything related to this topic on Google and since I'm a newbie on Nginx I'd like to ask a question about load balancing: I have a dedicated server currently running Apache with multiple accounts and domains. I'd like to switch to Nginx and set up a load balance only for one of these domains (mydomain1.com) to load balance traffic between this dedicated server and another 3 ones. I have the following Nginx config (/etc/nginx/conf.d/default.conf) on my dedicated server: </p>
  
  <pre><code>upstream mywebsite1  {
    ip_hash;
    server xxx.xxx.xxx.196 weight=1 max_fails=3 fail_timeout=15s;
    server xxx.xxx.xxx.67 weight=1 max_fails=3 fail_timeout=15s;
    server xxx.xxx.xxx.201 weight=1 max_fails=3 fail_timeout=15s;
  }
  
  server {
      listen       80;
      server_name  mywebsite1.com;
  
      access_log /var/log/nginx/proxy.log;
  
      location / {
          proxy_pass http://mywebsite1;
      }
  
      #error_page  404              /404.html;
  
      # redirect server error pages to the static page /50x.html
      #
      error_page   500 502 503 504  /50x.html;
      location = /50x.html {
          root   /usr/share/nginx/html;
      }
  
      # proxy the PHP scripts to Apache listening on 127.0.0.1:80
      #
      #location ~ \.php$ {
      #    proxy_pass   http://127.0.0.1;
      #}
  
  }
  </code></pre>
  
  <p>But this is not working and when I read the proxy.log is also balancing traffic not just from mywebsite1.com, but also from my other domains: mywebsite2.com, mywebsite3.com, etc. Any help is really appreciated since as you see I'm not an expert! Thanks :)</p>