Conflicting location blocks...

mike mike503 at
Tue Sep 16 04:00:04 MSD 2008

I have this config -

The location block to set expires headers breaks the alias location.
Is there a way to get them to both work?

Everything that matches should issue an expires header.

However, I want to alias /icommon to another path. According to the
wiki this is the right syntax, but once again I am stuck with location
confusion :)

server {
                listen 80;
                index index.php;
                root /home/test/web/;
                location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html)$ {
                        expires max;
                location /icommon/ {
                        alias /home/test/web/;

I have to comment out the expires block for now, or it won't work. Is
this a bug? How else can I do an alias? I tried setting "root" for
that location, and it "sorta" works, the problem is is it tries to
append the location, which doesn't work for me, unless I rename the
file paths and set the "root" to the directory above it...

                location /icommon/ {
                        root /home/test/web/;

Maps to this then /home/test/web/;

Would have to set root to /home/test/web/, and
then rename "icommon" to "common" on the filesystem...

I think there might be a slight bug in how "alias" handling is done?
Shouldn't it basically be like redefining a "root" ?


More information about the nginx mailing list