Nginx — static file serving confusion with root & alias

前端 未结 7 1237
[愿得一人]
[愿得一人] 2020-11-22 15:29

I need to serve my app through my app server at 8080, and my static files from a directory without touching the app server. The nginx config I have is something

7条回答
  •  长情又很酷
    2020-11-22 16:08

    as say as @treecoder

    In case of the root directive, full path is appended to the root including the location part, whereas in case of the alias directive, only the portion of the path NOT including the location part is appended to the alias.

    A picture is worth a thousand words

    for root:

    for alias:

提交回复
热议问题