fanpei0121
V2EX  ›  问与答

nuxt 项目 ngin 配置 https 不能访问静态资源文件

  •  
  •   fanpei0121 · Oct 17, 2019 · 2834 views
    This topic created in 2409 days ago, the information mentioned may be changed or developed.

    http 可以正常访问,nginx 做的反向代理到 nuxt 的 3001 端口.https 下项目可以访问但是 css,js 文件报 404。

    nginx 配置如下

        location / {
    		expires $expires;
    
    		proxy_redirect                      off;
    		proxy_set_header Host               $host;
    		proxy_set_header X-Real-IP          $remote_addr;
    		proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
    		proxy_set_header X-Forwarded-Proto  $scheme;
    		proxy_read_timeout          1m;
    		proxy_connect_timeout       1m;
    		proxy_pass                          http://127.0.0.1:3001; 
    	}
    
    fanpei0121
        1
    fanpei0121  
    OP
       Oct 17, 2019
    解决了

    # location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    #{
    # expires 30d;
    #}

    # location ~ .*\.(js|css)?$
    #{
    # expires 12h;
    #}

    注释掉就行了,做个记录
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3095 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 07:02 · PVG 15:02 · LAX 00:02 · JFK 03:02
    ♥ Do have faith in what you're doing.