On Sun, Jun 21, 2009 at 7:32 AM, Edho P Arief <span dir="ltr"><<a href="mailto:edhoprima@gmail.com">edhoprima@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Sun, Jun 21, 2009 at 8:21 PM, Kevin<br>
<div class="im">Castiglione<<a href="mailto:kevincastiglione@gmail.com">kevincastiglione@gmail.com</a>> wrote:<br>
</div><div class="im">> On Sat, Jun 20, 2009 at 10:30 PM, Edho P Arief <<a href="mailto:edhoprima@gmail.com">edhoprima@gmail.com</a>> wrote:<br>
>><br>
>> On Sun, Jun 21, 2009 at 12:19 PM, Edho P Arief<<a href="mailto:edhoprima@gmail.com">edhoprima@gmail.com</a>> wrote:<br>
>> ><br>
>> > here it is<br>
>> > server {<br>
>> > listen 80;<br>
>> > server_name ~(.*)\.([^\.]*)\.([^\.]*)$;<br>
>> > set $domain $2.$3;<br>
>> > rewrite ^.* http://$domain$request_uri permanent;<br>
>> > }<br>
>> ><br>
>> make sure that you have the server_name set on nginx or it'll redirect to<br>
>> .<br>
><br>
> can you tell how i set server_name on nginx for this to work?<br>
><br>
<br>
</div>create separate server block for each domain name<br>
<br>
server {<br>
listen 80;<br>
server_name <a href="http://abcd.com" target="_blank">abcd.com</a>;<br>
...<br>
}<br>
<br>
which will be used when nginx detects the domain as <a href="http://abcd.com" target="_blank">abcd.com</a><br>
<br>
without this block, the redirection will go like this:<br>
<a href="http://NNN.abcd.com" target="_blank">NNN.abcd.com</a> => <a href="http://abcd.com" target="_blank">abcd.com</a> => . (dot)<br>
<br>
with this it'll access correct site instead (stop at <a href="http://abcd.com" target="_blank">abcd.com</a>)</blockquote><div>is it possible to do this with just one server block for multiple domains:<br>for ex:<br>server {<br>
listen 80;<br> server_name .<a href="http://abcd.com">abcd.com</a> .<a href="http://efgh.com">efgh.com</a> .<a href="http://ijkl.com">ijkl.com</a><br> ..<br>}<br></div></div><br>