nuxt project is deployed to nginx
, and has been configured in nginx
location / {
try_files $uri $uri/ /;
root html;
index index.html index.htm;
}
solved the 404 problem caused by routing problems, but only jumped to the home page and did not display anything else depending on the route.
that is, both http://domain/xxx/5af
and http://domain/xxx/6bf
are displayed on the home page.
other nginx configurations have been tried later
-sharp one
location / {
try_files $uri $uri/ /index.html last;
root html;
index index.html index.htm;
}
-sharp two
location / {
try_files $uri $uri/ @router;
index index.html;
}
location @router {
rewrite ^.*$ / last;
}
all ended in failure.
everything is fine in the locahost environment. So I don"t know where there is something wrong with the nginx configuration, please give me your advice.
as a newcomer to IT, I don"t have a deep understanding of nginx. Thank you very much for your help.