Weird redirect

location /~redduck666 {
alias /home/redduck666/static_html;
}

this is what i have, and it works as expected.

than i add:

        location ~ .ogg$ {
            access_log /var/log/nginx/ogg.log;
        }

now, when i try to access /~redduck666/.ogg nginx behaves
weirdly:

2008/02/21 19:14:49 [error] 10444#0: *1985762 open()
“/usr/html/~redduck666/file.ogg” failed (2: No such file or
directory), client: 89.142.54.200, server: static.kiberpipa.org,
request: “GET /~redduck666/file.ogg HTTP/1.1”, host:
static.kiberpipa.org”, referrer:
http://static.kiberpipa.org/~redduck666/

i have NO idea where it got the /usr/html part, it is not mentioned
anywhere in my config.

any pointers on what i am doing wrong?

On Thursday 21 February 2008, Almir K. wrote:

            access_log /var/log/nginx/ogg.log;

http://static.kiberpipa.org/~redduck666/

i have NO idea where it got the /usr/html part, it is not mentioned
anywhere in my config.

any pointers on what i am doing wrong?

first read how nginx uses location
http://wiki.codemongers.com/NginxHttpCoreModule#location

you probably need location like
location ~ /~redduck666/.+.ogg$ {alias /home/redduck666/static_html;

access_log /var/log/nginx/ogg.log;

}

On Thursday 21 February 2008, Almir K. wrote:

            access_log /var/log/nginx/ogg.log;

http://static.kiberpipa.org/~redduck666/

i have NO idea where it got the /usr/html part, it is not mentioned
anywhere in my config.

any pointers on what i am doing wrong?

firs read how nginx uses location

reading the docs helped (surprise, surprise), thanks :slight_smile:

perhaps it would be a good idea to allow nginx to apply more than one
configuration at a time?
That would create unreadable config files, I think.

Consider:

location /~redduck666 {
alias /home/redduck666/static_html;
}

location ~ .ogg$ {
access_log /var/log/nginx/ogg.log;
alias /home/redduck666/oggs;
}

From which root should /~redduck666/.ogg be served?
You probably will usggest the last location specified but this will
become
cumbersome when other config-files are included.

The current solution is very clear.

Regards,

Martin

On Thu, Feb 21, 2008 at 8:40 PM, Martin S. [email protected] wrote:

    alias /home/redduck666/static_html;

cumbersome when other config-files are included.
ok, i see where are you coming from, and i have to agree that you have
a valid point, however saying that the configuration will become
cumbersome is IMHO wrong, it might become cumbersome (depending on
how you write it), on the other hand it would give you the benefits
such as being able to do something based on ‘location’ ( /some/thing )
and based on extension (.ogg in my example)

On Fri, Feb 22, 2008 at 06:36:43AM +0100, Almir K. wrote:

location /~redduck666 {
You probably will usggest the last location specified but this will become
cumbersome when other config-files are included.

ok, i see where are you coming from, and i have to agree that you have
a valid point, however saying that the configuration will become
cumbersome is IMHO wrong, it might become cumbersome (depending on
how you write it), on the other hand it would give you the benefits
such as being able to do something based on ‘location’ ( /some/thing )
and based on extension (.ogg in my example)

If it might, it will certainly will be.

http://article.gmane.org/gmane.comp.web.nginx.english/2487/

reading the docs helped (surprise, surprise), thanks :slight_smile:

perhaps it would be a good idea to allow nginx to apply more than one
configuration at a time?