I was trying to use nignx try_files in the "server" block. I arrived at this question: Nginx try_files doesn't work inside server block
My use case is different, because there is only cache header settings in the location block:
server { listen 80; root /app; index index.html; try_files $uri $uri/ /index.html; location /assets/ { add_header "Cache-Control" "public"; expires 1d; } location / { add_header "Cache-Control" "no-cache"; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } } I already read How nginx processes a request, but i'm still confused why it doesn't work.
In the comments on the above question someone mentioned that try_files has been moved to ngx_http_try_files_module.
On the nginx documentation page, i can't find this module, and try_files is still documented in the core module: https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
According to this try_files can be used in the server block, so i can't understand why my config doesn't work.
Can some explain/point me to the right direction?