Forum: NGINX Do you put all your virtual host info in nginx.conf?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E84e93646376def3fbed0907fe9335e1?d=identicon&s=25 Max (Guest)
on 2009-02-18 06:31
(Received via mailing list)
Hello,

Do you put all your virtual host info in nginx.conf? Since I got a lot
of
virtual hosts, if I put all of them into nginx.conf, I found it's rather
big. Just want to know what's the best practice to handle many virtual
hosts. Thanks.

Max
Ed6583386f2b2d56e1b5eb2ee236da39?d=identicon&s=25 Nick Pearson (Guest)
on 2009-02-18 06:41
(Received via mailing list)
The best way is to include separate config files using the include
directive:
http://wiki.codemongers.com/NginxHttpMainModule#include

Nick
7b8fb033ada5a3242ebc30d8cd1c1554?d=identicon&s=25 Joe (Guest)
on 2009-02-18 06:44
(Received via mailing list)
I also put all virtual host conf into nginx, separate them on
virtual.conf.
7b8fb033ada5a3242ebc30d8cd1c1554?d=identicon&s=25 Joe (Guest)
on 2009-02-18 06:51
(Received via mailing list)
Yes, that's the best way to configure it.
E84e93646376def3fbed0907fe9335e1?d=identicon&s=25 Max (Guest)
on 2009-02-18 09:06
(Received via mailing list)
I just wonder it will be more difficult if I want to change things for
multiple sites (multiple virtual conf files).  For example, if I want to
change ip from 111.111.111.111 to 222.222.222.222, I just open the
nginx.conf and so a search and replace, it will be replaced them all at
once. If it's in multiple virtual file, I need to open those doamins
which
are using 111.111.111.111 and chagne them manually.
2e321cc0efe9422d37165e922298494e?d=identicon&s=25 Cliff Wells (Guest)
on 2009-02-18 09:16
(Received via mailing list)
On Wed, 2009-02-18 at 15:56 +0800, Max wrote:
>  I just wonder it will be more difficult if I want to change things
> for multiple sites (multiple virtual conf files).  For example, if I
> want to change ip from 111.111.111.111 to 222.222.222.222, I just open
> the nginx.conf and so a search and replace, it will be replaced them
> all at once. If it's in multiple virtual file, I need to open those
> doamins which are using 111.111.111.111 and chagne them manually.

Use the "map" directive to map domain names to IP addresses.  That is
stored in its own file, mappings.conf.  Then each domain gets its own
conf file that is included.

http://wiki.codemongers.com/NginxHttpMapModule

This way, to change an IP address, you only need to edit the
mappings.conf file.

Cliff
Bb733007e780ecc8f07712700f8c586e?d=identicon&s=25 David GIbbons (Guest)
on 2009-02-18 09:20
(Received via mailing list)
Doesn't seem any harder to me.

sed -i.bak 's/111.111.111.111/222.222.222.222/g' *.conf

-dg
7b8fb033ada5a3242ebc30d8cd1c1554?d=identicon&s=25 Joe (Guest)
on 2009-02-18 09:21
(Received via mailing list)
A records usually configured in DNS zone. Do you use bind? Simply put
listen
PORT; without IP.
76a2d21bcd2eb480e4364a09ea77457a?d=identicon&s=25 Olivier Bonvalet (Guest)
on 2009-02-18 09:32
(Received via mailing list)
I use a "catchall" setup.

Joe a écrit :
E84e93646376def3fbed0907fe9335e1?d=identicon&s=25 Max (Guest)
on 2009-02-18 13:32
(Received via mailing list)
Yes, I am currently using catchall as well. But all virtaul host hogs
going
to one big log file. I am using 0.633. I can't use something like
path/$host.access.log  main; to have seperate log files.
This topic is locked and can not be replied to.