Location Alias not working

Francis Daly francis at daoine.org
Sat Aug 27 22:52:02 UTC 2016


On Sat, Aug 27, 2016 at 11:18:04PM +0200, Andrew Holway wrote:

Hi there,

> Can you post your full config pls?

==
  server {
    listen 8080;
    server_name x1;

    location /foo/ {
      alias /var/www/foo/;
    }
  }
==

curl -v -H Host:x1 http://127.0.0.1:8080/foo/a

gives a 200 with the contents of the file /var/www/foo/a

curl -v -H Host:x1 http://127.0.0.1:8080/foo/b

gives a 404, error.log says

open() "/var/www/foo/b" failed (2: No such file or directory), client:
127.0.0.1, server: x1, request: "GET /foo/b HTTP/1.1", host: "x1"

(The events{} and surrounding http{} blocks exist in the config too.)

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list