nginx.conf中这种配置,在访问localhost/index的时候,会404
location / {
root /usr/local/nginx/html/dist;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
如果是这种配置那么localhost/index则能找到
location / {
root /usr/local/nginx/html/dist;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
在部署ruoyi前端项目的时候,遇到了接口一直报401,然后重新换了一个nginx.conf文件就可以了