Home  >  Q&A  >  body text

After project packaging and uploading, nginx cannot be returned after configuring nginx.

It should have returned json data, but instead returned index.html. The project can be run locally, but after sending it to the server, such an error occurred. Solution

nginx configuration

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

The packaged directories of the server are static and index.html, and the packaged index.html is proxied, so it is text/html

/etc/nginx/mime.types configuration

type {
  text/html html htm shtml    
}
巴扎黑巴扎黑2714 days ago402

reply all(1)I'll reply

  • 仅有的幸福

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

    Look at the error reported above. It means that what you returned is not a correct json. Please post the interface of your backend to spit out data

    reply
    0
  • Cancelreply