0

This might be a silly question but I cannot set nginx to serve files from a folder in a custom location (ie outside the default root) I am using nginx inside a docker container but this should alter the process.

I have seen the following posts here and here and maybe using an alias could help me but I wonder why the following does not work.

I have a folder holding my website: /mirrors/my-folder The nginx.conf is set to default and it includes the following specific config: /etc/nginx/conf.d/my-server.conf

server {
    listen 10000;

    root /mirrors/my-folder;
    location / {
        autoindex on;
    }
}

When I try to access the server on http://my-ip:10000/ I get the default Welcome page, served from /usr/share/nginx/html Where I would expect to get the root of /mirrors/my-folder...

Here is the access.log

10.x.x.x - - [16/Feb/2018:17:46:23 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36" "-"

And the error.log (showing a missing favicon):

2018/02/16 17:45:59 [error] 13#13: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 10.x.x.x, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "10.x.x.x:10000", referrer: "http://10.x.x.x:10000/"
10.0.0.113 - - [16/Feb/2018:17:45:59 +0000] "GET /favicon.ico HTTP/1.1" 404 571 "http://10.0.0.124:10000/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36" "-"

Any idea of what could be wrong in my config ?

jeromes
  • 131
  • 4

1 Answers1

0

Whenever any changes were done to the nginx.conf file. Please reload the nginx to bring the changes. The command is nginx -s reload.

Pooja
  • 1