I am setting up vue(2.1.x) with nginx(1.10.2), I have following configuration:
location / {
root /var/lib/myRepo/dist/;
index index.html;
}
This works when I hit ' http://localhost:8080/ ', but when I hit other URLs like: ' http://localhost:8080/products/home ', I get:
404 Not Found
I also tried following:
root /var/lib/myRepo/dist/;
location / {
try_files $uri $uri/ index.html$query_string;
}
What can be wrong here and how to correct this.
you can follow like this:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
try_files $uri $uri/ @router;
index index.html;
}
location @router {
rewrite ^.*$ /index.html last;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.