我的有角应用程序有一个多阶段docker映像,它使用nginx:alpine基本映像。我有以下nginx配置和VHOST设置文件(在docker容器内)。
/etc/nginx/nginx.conf
/etc/nginx/conf.d/default.conf
我的项目文件在]下>
/usr/share/nginx/html
以下是我的配置:
1。 default.conf
server { listen 0.0.0.0:80; listen [::]:80; default_type application/octet-stream; gzip on; gzip_comp_level 6; gzip_vary on; gzip_min_length 1000; gzip_proxied any; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_buffers 16 8k; client_max_body_size 256M; root /usr/share/nginx/html; location / { try_files $uri $uri/ /index.html =404; } }
2。 nginx.conf
user nginx; worker_processes auto; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; }
您可以看到,mime.types文件已经包含在内,并且该文件位于给定的路径中。
[当我运行此应用程序时,我在浏览器中得到以下错误(对于已加载的CSS和javascript文件):
Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
我尝试了论坛中建议的许多组合,但是没有运气。如果您有解决方案的提示,请告诉我。
我为我的角度应用程序使用了多阶段docker映像,该映像使用了nginx:alpine基本映像。我在docker容器中有以下nginx配置和VHOST设置文件。 / etc / nginx / nginx ....
是否有任何更新?我有同样的问题