16 messages in ru.sysoev.nginxRe: Mixed Virtualhosts and IP hosts
FromSent OnAttachments
DavidAug 30, 2008 8:02 pm 
mikeAug 30, 2008 8:18 pm 
Igor SysoevAug 30, 2008 11:34 pm 
Igor SysoevAug 30, 2008 11:35 pm 
mikeAug 30, 2008 11:58 pm 
Igor SysoevAug 31, 2008 12:17 am 
Igor SysoevAug 31, 2008 12:22 am 
mikeAug 31, 2008 12:29 am 
Igor SysoevAug 31, 2008 12:30 am 
mikeAug 31, 2008 12:31 am 
mikeAug 31, 2008 12:37 am 
Scott LarsonAug 31, 2008 12:59 am 
mikeAug 31, 2008 1:18 am 
Scott LarsonAug 31, 2008 1:52 am 
mikeAug 31, 2008 1:58 am 
DavidAug 31, 2008 6:13 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Mixed Virtualhosts and IP hostsActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Aug 30, 2008 11:34:20 pm
List:ru.sysoev.nginx

On Sun, Aug 31, 2008 at 03:03:05AM +0000, David wrote:

I have 2-3 IPs.

I would like 2 IPs to be IP based hosts, and the 3rd IP to host my virtualhosted sites.

Currently I have setup each domain with it's own config file that is called into nginx.conf inside the http {} section.

The IP based hosts are working fine, but I would like to check if I am doing things right for the virtual hosts.

Each virtual host looks like this:

server { listen xxx.xxx.xxx.xxx; server_name sub.domain.com www.sub.domain.com; access_log /var/log/nginx/sub.domain.com.access.log main;

location / { index index.php index.html; root /home/subdomain/public_html/images; }

}

So each virtualhost has the same IP.

Will this work ok ? or do all virtualhosts need to be in their own http {} section ?

You need the single http {} section with many server {} sections. Inside server you may use any combinations of IPs, ports, and names, they should work as one may expect. If there are duplicates names on some IP, nginx will warn you and ignore the duplicate.