Thank you.<br><br><div><span class="gmail_quote">On 9/12/08, <b class="gmail_sendername">Igor Sysoev</b> <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Fri, Sep 12, 2008 at 03:24:12PM +0200, Gregor Jurgele wrote:<br> <br> > Dave, Igor, thank you both for your prompt replies.<br> ><br> > Does a web server have to have a default site defined? The thing is, if I do<br>
 <br> <br>Yes, there is always default site for given IP:port. This site receives<br> all request wiht unknown "host" headers or request without the header.<br> <br> By default the default site will first site with given IP:port.<br>
 You can overide this using<br> <br>     server {<br>        listen  IP:PORT  default;<br> <br><br> > not explicitly declare a default site and leave all my files as they are,<br> > meaning the included file is named <a href="http://www.bona-a.com">www.bona-a.com</a> (or <a href="http://www.bona-b.com">www.bona-b.com</a> ...<br>
 > <a href="http://www.bona-d.com">www.bona-d.com</a>), then the <a href="http://www.bona-a.com">www.bona-a.com</a> site becomes the default site. If I<br> > access f.e. <a href="http://mail.bona-a.com">mail.bona-a.com</a> I receive the <a href="http://www.bona-a.com">www.bona-a.com</a> web page. But if I<br>
 > name the above file <a href="http://www.bona-e.com">www.bona-e.com</a> or <a href="http://www.bona.com">www.bona.com</a>, then suddenly there is<br> > no default site and I receive 403 Forbidden if I try to access f.e.<br>
 > <a href="http://mail.bona-a.com">mail.bona-a.com</a>. So a change from letter a to e in a file name<br> > <a href="http://www.bona-a.com">www.bona-a.com</a> changes the behavior of the server from "default web site<br>
 > defined" to "default web site not defined".<br> ><br> > Regards,<br> ><br> > Gregor<br> ><br> > On 9/12/08, Igor Sysoev <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>> wrote:<br>
 > ><br> > > On Fri, Sep 12, 2008 at 10:59:47AM +0200, Gregor Jurgele wrote:<br> > ><br> > > > I would like to run a few virtual sites on one IP on nginx 0.6.32<br> > > compiled<br> > > > from source as Debian package on Debian Etch.<br>
 > > ><br> > > > My nginx.conf contents are:<br> > > ><br> > > > user www-data;<br> > > > worker_processes  1;<br> > > ><br> > > > error_log  /var/log/nginx/error.log;<br>
 > > > pid        /var/run/nginx.pid;<br> > > ><br> > > > events {<br> > > >     worker_connections  1024;<br> > > > }<br> > > ><br> > > > http {<br> > > >     include       /etc/nginx/mime.types;<br>
 > > >     default_type  application/octet-stream;<br> > > ><br> > > >     access_log  /var/log/nginx/access.log;<br> > > ><br> > > >     sendfile        on;<br> > > >     #tcp_nopush     on;<br>
 > > ><br> > > >     #keepalive_timeout  0;<br> > > >     keepalive_timeout  65;<br> > > >     tcp_nodelay        on;<br> > > ><br> > > >     gzip  on;<br> > > ><br>
 > > >     server_tokens     off;<br> > > ><br> > > >     include /etc/nginx/conf.d/*.conf;<br> > > >     include /etc/nginx/sites-enabled/*;<br> > > > }<br> > > ><br>
 > > > My virtual site file (<a href="http://www.bona-a.com">www.bona-a.com</a>) contents are:<br> > > ><br> > > > server {<br> > > >         listen   80;<br> > > >         server_name  <a href="http://www.bona-a.com">www.bona-a.com</a>;<br>
 > > ><br> > > >         access_log  /var/log/nginx/www.bona-a.com.access.log;<br> > > ><br> > > >         location / {<br> > > >                 root   /var/www/<a href="http://www.bona-a.com">www.bona-a.com</a>;<br>
 > > >                 index  default.html default.htm index.html index.htm;<br> > > >         }<br> > > ><br> > > >         # pass the PHP scripts to FastCGI server listening on<br> > > <a href="http://127.0.0.1:9000">127.0.0.1:9000</a><br>
 > > >         #<br> > > >         #location ~ \.php$ {<br> > > >                 #fastcgi_pass   <a href="http://127.0.0.1:9000">127.0.0.1:9000</a>;<br> > > >                 #fastcgi_index  index.php;<br>
 > > >                 #fastcgi_param  SCRIPT_FILENAME<br> > > > /scripts$fastcgi_script_name;<br> > > >                 #includefastcgi_params;<br> > > >         #}<br> > > > }<br>
 > > ><br> > > > If I name a file or symbolic link in /etc/nginx/sites-enabled/, that<br> > > holds<br> > > > the information for a virtual site, <a href="http://www.bona-a.com">www.bona-a.com</a>, this site becomes a<br>
 > > > catch-all site, answering all requests that go to the same ip and do not<br> > > > match any of the sites defined in other files in<br> > > /etc/nginx/sites-enabled/.<br> > > ><br> > > > Same is if I replace -a with - followed by any letter between b and d<br>
 > > > (including). If I name the file <a href="http://www.bona-e.com">www.bona-e.com</a> or <a href="http://www.bona.com">www.bona.com</a>,<br> > > everything<br> > > > works fine and i get 403 Forbidden as a reply.<br>
 > > ><br> > > > What am I doing wrong?<br> > ><br> > ><br> > > nginx does not sort include'd files, so the best way is to define default<br> > > site before the include.<br> > ><br>
 > ><br> > ><br> > > --<br> > > Igor Sysoev<br> > > <a href="http://sysoev.ru/en/">http://sysoev.ru/en/</a><br> > ><br> > ><br> <br> <br>--<br> <br>Igor Sysoev<br> <a href="http://sysoev.ru/en/">http://sysoev.ru/en/</a><br>
 <br> </blockquote></div><br>