Mixed Virtualhosts and IP hosts

mike mike503 at gmail.com
Sun Aug 31 07:19:11 MSD 2008


i think you only need one http {} for each specific http "instance"

you can have hundreds of server {} blocks inside of http {} - based on
the Host: header will answer. i only have one http {} block for
hundreds of sites. if nginx is listening on all interfaces it will use
the same instance.

i do have a second http {} block for a mogilefs webdav server, only
because of the separate http configuration needed.

On 8/30/08, David <mishy.cth at gmail.com> wrote:
> Hello,
>
> 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 ?
>
> Thank you
>
>
>





More information about the nginx mailing list