<font color="#333399"><font>Hello,<br><br>Typically, I would use one directory per host to serve content from each domain and use one config file per generic type:<br>http {<br> listen 80;<br> root /var/www/$host;<br></font></font><font color="#333399"><font><br>
server { # Include that section from a separate file<br>
server_name ~^[[:alnum:]]+(</font></font><font color="#333399"><font>\.[[:alnum:]]+</font></font><font color="#333399"><font>)*\.preprod\.domain[0-9]*\.com$;<br>
# Pre-production rules<br>
}<br>
</font></font><br><font color="#333399"><font> server { # Include that section from a separate file<br> server_name ~^[[:alnum:]]+</font></font><font color="#333399"><font>(</font></font><font color="#333399"><font>\.[[:alnum:]]+</font></font><font color="#333399"><font>)*</font></font><font color="#333399"><font>(!\.preprod)\.domain</font></font><font color="#333399"><font>[0-9]*</font></font><font color="#333399"><font>\.com$;<br>
# Production rules<br> }<br></font></font><font color="#333399"><font></font></font><font color="#333399"><font>}<br><br>You can then create server bloc listening to specific subdomains for particular case, i.e.:<br>
server {<br> server_name <a href="http://test.preprod.domain42.com">test.preprod.domain42.com</a>;<br> # Rules here have higher priority than the generic rules since the server_name uses an exact match comparison<br>}<br>
<br>You will have to work further on regex to be sure they do what you want them to do. ;o)<br clear="all"></font></font><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font><br>
<br><br><div class="gmail_quote">On Wed, May 16, 2012 at 5:08 AM, Greg <span dir="ltr"><<a href="mailto:greg@2lm.fr" target="_blank">greg@2lm.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
I'm going to migrate a lots of vhosts from Squid+Apache2 to NginX,
step by step.<br>
First step is to migrate just NginX and few static vhosts.<br>
<br>
Actually there is ~600 domains x 5 vhosts + equivalent for preprod.
So I wrote a NginX vhost for ".<a href="http://mydomain1.com" target="_blank">mydomain1.com</a> .<a href="http://mydomain2.com" target="_blank">mydomain2.com</a>" and so
on with the 600 domains.<br>
<br>
Question is, how the best practices to have this domains for our
preprod which looks like ".<a href="http://preprod.mydomain1.com" target="_blank">preprod.mydomain1.com</a>" for each domains.<br>
<br>
Preprod has specific config like gzip disabled (for internals
purpose...).<br>
<br>
Actually, prod's config looks like :<br>
<tt>server {<br>
server_name .<a href="http://mydomain1.com" target="_blank">mydomain1.com</a>; # main domain<br>
include
/etc/nginx/domains.conf;<br>
server_name_in_redirect off;<br>
include common/prod.conf<br>
}</tt><br>
<br>
And domains.conf :<br>
<tt>server_name<br>
.<a href="http://mydomain1.com" target="_blank">mydomain1.com</a><br>
.<a href="http://mydomain2.com" target="_blank">mydomain2.com</a><br>
...<br>
;</tt><br>
<br>
Preprod could have this config :<br>
<tt>server {<br>
server_name .<a href="http://preprod.mydomain1.com" target="_blank">preprod.mydomain1.com</a>; # main domain<br>
include
/etc/nginx/preprod_domains.conf;<br>
server_name_in_redirect off;<br>
include common/preprod.conf<br>
}</tt><br>
<br>
Which means (600 x 5 x 2) vhosts...<br>
<br>
Is there a better way ?<span class="HOEnZb"><font color="#888888"><br>
<br>
<div>-- <br>
Greg<br>
</div>
</font></span></div>
<br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br></blockquote></div><br>