My root directory
/web/app/src
In this directory I have 2 directories /js/ and /assets/ and one file index.html
This is what I need to achieve:
Any request to /js/ or /assets/ or /index.html just serve files from root directory For example myapp.com/js/app.js servers app.js from /web/app/src/js/ directory Same with requests to /assets/
But all other requests, any other uri should result in serving index.html
For example
myapp.com/bla/bla/q?param=x Should serve index.html from web root directory
All rewrites should be internal, no http 301 redirects.
Sir, please try below code. :)
server {
...
root /web/app/src;
...
location / {
try_files $uri $uri/ /index.html;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With