我正在使用 angular-cli 和 laravel 5.5
当我打开我的项目时,它给了我以下三个错误:
inline.bundle.js:1 Uncaught SyntaxError: Unexpected token <
polyfills.bundle.js:1 Uncaught SyntaxError: Unexpected token <
main.bundle.js:1 Uncaught SyntaxError: Unexpected token <
当我检查那些 .js 文件时,我发现它们被用作 index.html。不仅是 js,而且所有其他文件都用作 index.html,当它尝试运行 js 但找到 HTM 标签并引发错误时。
nginx.conf
> server {
> server_name localhost;
> index index.php index.html;
> root /var/www/public;
>
> location / {
> try_files $uri /index.php?$args;
> }
>
> location ~ \.php$ {
> fastcgi_split_path_info ^(.+\.php)(/.+)$;
> fastcgi_pass php:9000;
> fastcgi_index index.php;
> include fastcgi_params;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> fastcgi_param PATH_INFO $fastcgi_path_info;
> } }
>
> server { listen 80; listen [::]:80; return
> 301 https://$host$request_uri; }