我用 angular 写了个程序,然后托管在 minio 上,其中用了路由功能,nginx 我就不知道怎么配置了 以下是我失败的配置,主要是静态文件不知道怎么配置
server {
listen 80;
server_name ci-monitor.cc-mobile.cn
# To allow special characters in headers
ignore_invalid_headers off;
# Allow any size file to be uploaded.
# Set to a value such as 1000m; to restrict file size to a specific value
client_max_body_size 1000m;
# To disable buffering
proxy_buffering off;
location ~* \.(jpg|jpeg|gif|png|ico|css|js|pdf|txt|svg|map|json|ttf|woff|woff2)$ {
proxy_pass http://192.168.44.229:9000/website/ci-monitor/$1/$2;
}
location / {
rewrite ^/$ /website/ci-monitor/index.html break;
# proxy_set_header Host $http_host;
# rewrite ^ /index.html break;
proxy_pass http://192.168.44.229:9000/website/ci-monitor/index.html;
}
}
我这个配置会导致这个问题
Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.
runtime-es2015.edb2fcf2778e7bf1d426.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.
polyfills-es2015.55a4aa6ad9b7515939f7.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.
我看我的最外面是加了 mime.type 的
# my
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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;
}
1
lpd0155 2019-12-02 21:36:02 +08:00 via Android
不是 MIME 报错吗,改一下
|
3
lpd0155 2019-12-02 22:25:03 +08:00 via Android
Include /path/to/mime.types
|