首页  >  问答  >  正文

项目打包上传配置完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    
}
巴扎黑巴扎黑2714 天前403

全部回复(1)我来回复

  • 仅有的幸福

    仅有的幸福2017-05-16 17:09:40

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

    回复
    0
  • 取消回复