Behavior of server depends on a file name

Gregor Jurgele gregor.jurgele at gmail.com
Fri Sep 12 17:45:50 MSD 2008


Thank you.

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


More information about the nginx mailing list