原nginx配置项
http{
server {
listen 8020;
server_name localhost;
root xx/xx/dist;
location / {
charset utf-8;
index index.html;
try_files $uri $uri/ /index.html;
}
}
}
页面报错
原因为返回的js文件类型皆为 text/plain,需要设定一个默认值
在http下设置默认值即可
如下
http{
include xx/xx/conf/mime.types; //新增
default_type application/octet-stream;//新增
server {
listen 8020;
server_name localhost;
root xx/xx/dist;
location / {
charset utf-8;
index index.html;
try_files $uri $uri/ /index.html;
}
}
}