托管 Laravel Filament Apache 服务器响应 MIME 类型为“”

托管 Laravel Filament Apache 服务器响应 MIME 类型为“”

我一直尝试使用 Apache 将我的 Laravel Fiber 项目托管到我的服务器中,但在部署时我遇到了 2 个我从未见过的问题

图片相关

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.

Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: http://103.179.216.68/js/filament/forms/components/select.js?v=3.0.0.0

这是我的 apache vhost 配置

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/Infakin-2.0/public"
    ServerName panelinfakin.ictitlmi.info
    <Directory "C:/xampp/htdocs/Infakin-2.0/public">
            Options Indexes FollowSymLinks Includes ExecCGI
            AllowOverride All
            Order allow,deny
            allow from all
            Require all granted
        </Directory>
</VirtualHost>

最后,当使用 artisan serve 进行开发时,问题没有出现,这让我怀疑我的 xampp apache 存在问题,提前非常感谢。

答案1

尝试使用 htaccess 查看:选项 -MultiViews -Indexes

RewriteEngine On

# Handle MIME type for JavaScript files
<FilesMatch "\.(js)$">
    ForceType 'text/javascript'
</FilesMatch>

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

相关内容