Nginx multiple server blocks

view story

http://serverfault.com – Im having an issue trying to configure Nginx to work with gitlab and some other sites I have. I have foo.com that points to my server. bar.foo.com also points to my server. I'm trying to have gitlab on bar.foo.com, and another website on foo.com I thought I could easily do this using server blocks and server_names, but this doesnt appear to be correct. What I tried doing is defining 3 different server blocks, with different server names. But this doesnt work. What happens is that when I try accessing foo.com I end up on bar.foo.com which is gitlab. I keep just ending up on gitlab whate (HowTos)