Mixed IP and Name Based Virtual Hosts with nginx

I set up many domains but I dont know how to configure if only ip address is given.

say foo.com I have a setup to go web/foo.com/htdocs, I want to 88.99.66.55 ip address like a domain to web/fook.com/htdocs

server {
    listen       80;
    server_name  85.99.66.55;
    location / {
            root  /home/web/fook.com/htdocs;
    }
 location ~ \.(php|php3|php4|php5)$ {
                root          /home/web/fook.com/htdocs;
                include       fastcgi_params;
                fastcgi_pass  127.0.0.1:9000;
        }
    }

resulted

  [warn]: conflicting server name "85.105.65.219" on 0.0.0.0:80, ignored

Solution 1:

The IP 0.0.0.0 means all IPs. So what I think you want is something more like:

server {
    listen       85.99.66.55:80;
    server_name *.fook.com;
    location / {
        root  /home/web/fook.com/htdocs;
    }
}


server {
    listen       85.99.66.55:80;
    server_name *.arf.com;
    location / {
        root  /home/web/arf.com/htdocs;
    }
}

You want to keep your network layers straight here. server_name is for the HOST header in the HTTP (Layer 7) request where as Listen is for IP and Port -- the network and transport layers, or the IP and TCP Packets (Layers 3 and 4).