0

This is a bit of a beginner question, but I'm trying to make Nginx serve a static file server that contains symlinked folders. Eg, the root directory might contain directories A and B, which each contain symlinks to one other, eg A/B -> B and B/A -> A and I'd like http://localhost/A/B/A/B to follow the symlinks and render the index.html in B.

This is the config file I've tried after reading many tutorials and examples, but I'm still not quite understanding:

http {
    server {
        listen 8011;

        location / {
            autoindex on;
            disable_symlinks off;
            root /Users/me/project/test_project/build;
        }
    }
}

events {
  worker_connections  4096;  ## Default: 1024
}
ak0000
  • 101
  • 1
  • So what is happening with this configuration? – Tero Kilkanen Aug 24 '22 at 20:25
  • @TeroKilkanen It doesn't even seem as if `http://localhost:8011/A/` is working, I get `404 Not Found`, only `http://localhost:8011/` works, so maybe I'm not even telling it to handle requests to subdirectories? Not sure. Thanks – ak0000 Aug 24 '22 at 22:23
  • Anything in nginx logs? – Tero Kilkanen Aug 24 '22 at 22:44
  • Nothing too surprising, requesting the root works, requesting anything else doesn't: 127.0.0.1 - - [24/Aug/2022:19:12:17 -0400] "GET / HTTP/1.1" 200 283 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36" 127.0.0.1 - - [24/Aug/2022:19:12:20 -0400] "GET /A/ HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36" – ak0000 Aug 24 '22 at 23:14
  • What is in error log? – Tero Kilkanen Aug 25 '22 at 06:25
  • @TeroKilkanen 2022/08/26 12:21:15 [error] 33075#0: *2 open() "/test_project/build/A/B" failed (2: No such file or directory), client: 127.0.0.1, server: , request: "GET /A/B HTTP/1.1", host: "localhost:8015" – ak0000 Aug 26 '22 at 16:22

0 Answers0