教程适用于history模式,假设域名假设为:auauz.net

原配置

1
2
3
4
5
6
7
server {
listen 80;
server_name auauz.net;
root /www/wwwroot/eladmin-web/dist;
index index.html;
error_page 404 /index.html;
}

修改如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
server {

listen 80;
server_name auauz.net;

location / {
root /www/wwwroot/eladmin-web/dist;
try_files $uri $uri/ @router;
index index.html;
}

location @router {
rewrite ^.*$ /index.html last;
}
}