nginx 部署踩过的坑-1(未完待续)

1、nginx设置https协议

 起初地址使用的是服务器的IP地址,使用https协议去访问会出现css、js加载不到,因为使用IP地址访问css、js等使用的http协议,默认我设置的是只有域名才会跳转,IP地址是不会自动跳转的,所以服务器在访问首页的使用找不到css、js等样式,所以会出现以下图形:

 当我检查的时候,错误就出现了。

Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure image '<URL>'. This request has been blocked; the content must be served over HTTPS.

Mixed Content: The page at 'https://www.biaoyun.online/' was loaded over HTTPS, but requested an insecure image 'http://39.96.**/wp-content/uploads/2019/03/favicon-e1555336685574-560x560.jpg'. This request has been blocked; the content must be served over HTTPS.

这个错误就是说,css、js等样式找不到,默认是访问服务器的IP地址,但是我的ssl证书绑定的是域名,访问IP地址一定会出现网站不安全的提示,所以css、js等样式根本就加载不出来。

解决方法:

问题的根本原因就是css、js等路径不正确,无非就是找到根本,改掉他。

我的网站是用wordpress做的,所以说我直接可以在后台将网站的URL直接改掉就可以了。

 

猜你喜欢

转载自blog.csdn.net/qq_41112887/article/details/89488839