Nginx serving off the wrong root

view full story

http://serverfault.com – I have 2 sites-enabled, with server_name as follows: server_name www.mysite.com mysite.com and server_name dev.mysite.com Problem: When I access the website via its IP address, by looking at the access/error logs, it appears that nginx is serving off the root of dev.mysite.com. How does nginx decide which to serve? Can we force it to serve off the root of www.mysite.com when the site is visited using its ip address? conf server { listen 80; server_name www.mysite.com mysite.com; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; root /var/ (HowTos)