从http切换到https出现js、css无法加载的原因其实很简单,就是协议的问题。
location ~ \.css {
add_header Content-Type text/css;
}
location ~ \.js {
add_header Content-Type application/x-javascript;
}
只需要在nginx上面加上头部支持混合协议就搞定了这个问题了。
这是一些原理的文章,给大家参考一下:
https://imququ.com/post/sth-about-switch-to-https.html
https://stackoverrun.com/cn/q/2653771
未经允许不得转载:微信信息发源地 » nginx配置之后,出现css、js无法加载成功
评论前必须登录!
登陆 注册