V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
HangoX
V2EX  ›  程序员

nginx + angular + minio 配置求助

  •  
  •   HangoX · 2019-12-02 21:30:55 +08:00 · 2068 次点击
    这是一个创建于 1851 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我用 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 条附言  ·  2019-12-03 12:41:52 +08:00

    我看我的最外面是加了 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
    lpd0155
        1
    lpd0155  
       2019-12-02 21:36:02 +08:00 via Android
    不是 MIME 报错吗,改一下
    HangoX
        2
    HangoX  
    OP
       2019-12-02 22:05:14 +08:00
    @lpd0155 道理我都懂,问题是我不知道怎么改😂
    lpd0155
        3
    lpd0155  
       2019-12-02 22:25:03 +08:00 via Android
    Include /path/to/mime.types
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   4455 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 04:06 · PVG 12:06 · LAX 20:06 · JFK 23:06
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.