Business scene
When using nginx for static resource forwarding, a 404 problem is reported when the page refreshes. As shown below:
The following picture is shown during normal request:
When the page is refreshed, or press F5, the following picture will appear:
Solution
In the Linux server, modify the nginx configuration file nginx.conf and add the following to the corresponding directory:
try_files $uri $uri/ /index.html last;
As shown in the figure:
My linux path is: /usr/local/nginx, you modify the nginx.conf configuration according to your nginx path.
The purpose of adding this line is to request the upper-level path of the current path when the page is refreshed or F5. After configuration, remember to restart nginx.