[英]Angular 4 app in nginx unable to load file
我已经使用Nginx部署了angular 4应用程序。 但是它无法加载js,css和其他文件。 我在控制台中看到这些错误
未捕获到的SyntaxError:意外令牌<inline.bundle.js:1
未捕获到的SyntaxError:意外的令牌<polyfills.bundle.js:1
未捕获到的SyntaxError:意外的令牌<scripts.bundle.js:1
未被捕获的ReferenceError:未在styles.bundle.js:1处定义webpackJsonp。styles.bundle.js:1(匿名)@ styles.bundle.js:1
未捕获到的SyntaxError:意外的令牌<vendor.bundle.js:1
未捕获的ReferenceError:未在main.bundle.js:1上定义webpackJsonp。main.bundle.js:1
我的nginx配置:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#alias /web-portal/;
root /var/www/html/web-portal/;
try_files $uri$args $uri$args/ /index.html =404;
}
}
请帮助我解决这个问题!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.