VPS Nginx loadbalancer

I wish to have a setup as follows:

A Loadbalancer (Nginx, psxxxx1 - hosting mydomain.com), distributing incoming requests to:
psxxxx2 (xx.xxx.xxx.xx:80, and made a subdomain (www2.mydomain.com) of mydomain.com)
psxxxx3 (xxx.xxx.xxx.xxx:80, and made a subdomain (www1.mydomain.com) of mydomain.com)

In order to have psxxxx1 work as a loadbalancer I have changed the nginx.conf (following these instructions http://sameerparwani.com/posts/load-balancing-with-nginx) into:

user dhapache;
worker_processes 2;

events {
worker_connections 2048;

http {
upstream mysite {
server xxx.xxx.xxx.xxx:80;
server xx.xxx.xxx.xx:80;

server {
server_name mydomain.com;
location / {
proxy_pass http://mysite;


vim: set syn=conf:

Note: I have also tried to write the servers in the upstream block section as:


However, when accessing mydomain.com I receive an ‘error id: “bad_httpd_conf”’.

I have reported the error and the answer was that this:

Unfortunately it’s not something you can setup on your VPS servers. We
don’t support this setup on VPS’s, so trying to have one VPS work as a
load balancer for one website and trying to loadbalance requests between
the two servers simply wouldn’t work on the system. You would have to
make sure all requests for the domain are being sent to one server (where
the domain is actually added). We really don’t support this either so
you’re going to be testing most of this on your own.

So… do any of you have any suggestions as to how loadbalancing with Nginx can be achieved without the ‘bad_httpd_conf’ error or how loadbalancing can be achieved at all?