Behavior of server depends on a file name

Igor Sysoev is at rambler-co.ru
Fri Sep 12 16:40:26 MSD 2008


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/





More information about the nginx mailing list