Thank you.<br><br><div><span class="gmail_quote">On 9/12/08, <b class="gmail_sendername">Igor Sysoev</b> &lt;<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt; 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> &gt; Dave, Igor, thank you both for your prompt replies.<br> &gt;<br> &gt; 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 &quot;host&quot; 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>&nbsp;&nbsp;&nbsp;&nbsp; server {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listen&nbsp;&nbsp;IP:PORT&nbsp;&nbsp;default;<br> <br><br> &gt; not explicitly declare a default site and leave all my files as they are,<br> &gt; 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>
 &gt; <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> &gt; 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>
 &gt; 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> &gt; no default site and I receive 403 Forbidden if I try to access f.e.<br>
 &gt; <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> &gt; <a href="http://www.bona-a.com">www.bona-a.com</a> changes the behavior of the server from &quot;default web site<br>
 &gt; defined&quot; to &quot;default web site not defined&quot;.<br> &gt;<br> &gt; Regards,<br> &gt;<br> &gt; Gregor<br> &gt;<br> &gt; On 9/12/08, Igor Sysoev &lt;<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt; wrote:<br>
 &gt; &gt;<br> &gt; &gt; On Fri, Sep 12, 2008 at 10:59:47AM +0200, Gregor Jurgele wrote:<br> &gt; &gt;<br> &gt; &gt; &gt; I would like to run a few virtual sites on one IP on nginx 0.6.32<br> &gt; &gt; compiled<br> &gt; &gt; &gt; from source as Debian package on Debian Etch.<br>
 &gt; &gt; &gt;<br> &gt; &gt; &gt; My nginx.conf contents are:<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; user www-data;<br> &gt; &gt; &gt; worker_processes&nbsp;&nbsp;1;<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; error_log&nbsp;&nbsp;/var/log/nginx/error.log;<br>
 &gt; &gt; &gt; pid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/var/run/nginx.pid;<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; events {<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; worker_connections&nbsp;&nbsp;1024;<br> &gt; &gt; &gt; }<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; http {<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; include&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /etc/nginx/mime.types;<br>
 &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; default_type&nbsp;&nbsp;application/octet-stream;<br> &gt; &gt; &gt;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; access_log&nbsp;&nbsp;/var/log/nginx/access.log;<br> &gt; &gt; &gt;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; sendfile&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; #tcp_nopush&nbsp;&nbsp;&nbsp;&nbsp; on;<br>
 &gt; &gt; &gt;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; #keepalive_timeout&nbsp;&nbsp;0;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; keepalive_timeout&nbsp;&nbsp;65;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; tcp_nodelay&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on;<br> &gt; &gt; &gt;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; gzip&nbsp;&nbsp;on;<br> &gt; &gt; &gt;<br>
 &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; server_tokens&nbsp;&nbsp;&nbsp;&nbsp; off;<br> &gt; &gt; &gt;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; include /etc/nginx/conf.d/*.conf;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; include /etc/nginx/sites-enabled/*;<br> &gt; &gt; &gt; }<br> &gt; &gt; &gt;<br>
 &gt; &gt; &gt; My virtual site file (<a href="http://www.bona-a.com">www.bona-a.com</a>) contents are:<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; server {<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; listen&nbsp;&nbsp; 80;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server_name&nbsp;&nbsp;<a href="http://www.bona-a.com">www.bona-a.com</a>;<br>
 &gt; &gt; &gt;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; access_log&nbsp;&nbsp;/var/log/nginx/www.bona-a.com.access.log;<br> &gt; &gt; &gt;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location / {<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root&nbsp;&nbsp; /var/www/<a href="http://www.bona-a.com">www.bona-a.com</a>;<br>
 &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index&nbsp;&nbsp;default.html default.htm index.html index.htm;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &gt; &gt; &gt;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # pass the PHP scripts to FastCGI server listening on<br> &gt; &gt; <a href="http://127.0.0.1:9000">127.0.0.1:9000</a><br>
 &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #location ~ \.php$ {<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #fastcgi_pass&nbsp;&nbsp; <a href="http://127.0.0.1:9000">127.0.0.1:9000</a>;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #fastcgi_index&nbsp;&nbsp;index.php;<br>
 &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #fastcgi_param&nbsp;&nbsp;SCRIPT_FILENAME<br> &gt; &gt; &gt; /scripts$fastcgi_script_name;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #includefastcgi_params;<br> &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #}<br> &gt; &gt; &gt; }<br>
 &gt; &gt; &gt;<br> &gt; &gt; &gt; If I name a file or symbolic link in /etc/nginx/sites-enabled/, that<br> &gt; &gt; holds<br> &gt; &gt; &gt; the information for a virtual site, <a href="http://www.bona-a.com">www.bona-a.com</a>, this site becomes a<br>
 &gt; &gt; &gt; catch-all site, answering all requests that go to the same ip and do not<br> &gt; &gt; &gt; match any of the sites defined in other files in<br> &gt; &gt; /etc/nginx/sites-enabled/.<br> &gt; &gt; &gt;<br> &gt; &gt; &gt; Same is if I replace -a with - followed by any letter between b and d<br>
 &gt; &gt; &gt; (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> &gt; &gt; everything<br> &gt; &gt; &gt; works fine and i get 403 Forbidden as a reply.<br>
 &gt; &gt; &gt;<br> &gt; &gt; &gt; What am I doing wrong?<br> &gt; &gt;<br> &gt; &gt;<br> &gt; &gt; nginx does not sort include&#39;d files, so the best way is to define default<br> &gt; &gt; site before the include.<br> &gt; &gt;<br>
 &gt; &gt;<br> &gt; &gt;<br> &gt; &gt; --<br> &gt; &gt; Igor Sysoev<br> &gt; &gt; <a href="http://sysoev.ru/en/">http://sysoev.ru/en/</a><br> &gt; &gt;<br> &gt; &gt;<br> <br> <br>--<br> <br>Igor Sysoev<br> <a href="http://sysoev.ru/en/">http://sysoev.ru/en/</a><br>
 <br> </blockquote></div><br>