Nginx, how do I proxy the html path?

for example: http://a.com/b/x.html

how do I proxy / b/x.html to the index.html in the server"s local path folder?

this configuration does not work, access appears 404

location ^~ /b/x\.html {
  root /data/a/;
}
Sep.16,2021

location ^~ /b/ {
  root /data/a/;
}

can also write a location.href= in an index.html, under the http://a.com/
directory.


location = /b/x.html {
    try_files /index.html $uri;
}
Menu