首页   注册   登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Coding
V2EX  ›  程序员

nginx + angular + minio 配置求助

  •  
  •   HangoX · 9 天前 · 484 次点击

    我用 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.
    
    第 1 条附言  ·  9 天前

    我看我的最外面是加了 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;
    }
    
    
    3 回复  |  直到 2019-12-02 22:25:03 +08:00
        1
    lpd0155   9 天前 via Android
    不是 MIME 报错吗,改一下
        2
    HangoX   9 天前
    @lpd0155 道理我都懂,问题是我不知道怎么改😂
        3
    lpd0155   9 天前 via Android
    Include /path/to/mime.types
    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   3543 人在线   最高记录 5043   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.3 · 24ms · UTC 05:15 · PVG 13:15 · LAX 21:15 · JFK 00:15
    ♥ Do have faith in what you're doing.