Get the App
SLTechnology News&Howtos  ›  Servers  › 

Nginx solves the method of VUE redirect refresh pointing to the home page

Shulou Source: shulou.com Published: 2022-06-01 00:26:36 11月14日 Update

This article introduces the relevant knowledge of "nginx to solve the problem of VUE redirect refresh pointing to the home page". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

When a user requests http://localhost/example, the $uri here is / example. Try_files will try to find this file on the hard drive. If there is a file named / $root/example (where $root is the project code installation directory), send the contents of the file directly to the user. Obviously, there is no file called example in the directory. Then look at $uri/, to add a /, that is, to see if there is a directory called / $root/example/. If it is not found, it will fall back to / index.php, the last option of try_files, and initiate an internal "sub-request", which is equivalent to nginx initiating a HTTP request to http://localhost/index.php.

`server {listen 808; # server_name rc.huanwei.tidecloud.com

Root / var/www/html; index login.html index.htm; # rewrite / index.html / login permanent; location / {try_files $uri $uri/ [@ router] (https://my.oschina.net/u/2258684); index index.html;} location [@ router] (https://my.oschina.net/u/2258684) {rewrite ^. * $/ index.html last) } location ~. *\. (gif | jpg | jpeg | png | bmp | swf | js | css | html) ${root / var/www/html/rc.huanwei.tidecloud.com;} location / api-customer {proxy_pass http://192.168.0.110:13200;}

}

This is the end of the content of "nginx solution to VUE redirect refresh pointing to the home page". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Files contents directories directions methods home page that is more users knowledge practicality learning and then code dilemma reality that is situations articles cases. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Microsoft Xiaomi Shulou Tech Info vpn