您的位置:首页技术文章
文章详情页

项目打包上传配置完nginx后无法返回json数据

【字号: 日期:2024-06-26 15:30:37浏览:90作者:猪猪

问题描述

项目打包上传配置完nginx后无法返回json数据

项目打包上传配置完nginx后无法返回json数据

项目打包上传配置完nginx后无法返回json数据

本来应该返回json数据,却返回了index.html,项目在本地跑是可以的,但是发到服务器上后就出现了这样的错误,求解

nginx配置

server { listen 80; server_name www.xxxx.cn; root /data/www/blog/; location / { try_files $uri $uri/ /index.html; } }

服务器的打包后目录为static和index.html, 代理到打包后的index.html,所以为text/html

/etc/nginx/mime.types配置

type { text/html html htm shtml }

问题解答

回答1:

看上面报错,是你返回的不是一个正确的json,贴下你后端的吐数据的接口吧

相关文章: