https里面 iframe 引用http的地址 无效_https安装证书方法

根据服务器的环境选择相应的证书下载并阅读配置教程即可。

2a888ce0de65920467f2fd54e9f6245c.png

安装成功后,使用SSL Labs Server Test 检查一下证书是否生效。

补充一下:

腾讯云面板下载的SSL证书压缩包里面包含各种服务器引擎的证书,你需要选择你的服务器类型比如我们用的是Nginx服务器,就需要上传Nginx专用的SSL证书。如果是IIS,就上传IIS专用的

服务器虚拟主机设置SSL证书路径

上传了SSL证书之后,我们还需在虚拟主机配置文件里面指定一下SSL证书的路径,不然访问会出错。

别的服务器我们并不了解。但是就我们现在用的WDCP面板+Nginx配置文件的写法是。你需要先找到

你服务器虚拟主机配置文件的路径,我们的是/conf/vhost/idedecms.com.conf各有不同,举一反三。

server { listen 80; root /www/web/idedecms_com/public_html; server_name idedecms.com idedecms.com www.idedecms.com img.idedecms.mysitecdn.com; index index.html index.php index.htm; error_page 400 /errpage/400.html; error_page 403 /errpage/403.html; error_page 404 /errpage/404.html; error_page 503 /errpage/503.html; location ~ .php$ { proxy_pass http://127.0.0.1:88; include naproxy.conf; } location ~ /.ht { deny all; } location / { try_files $uri @apache; } location @apache { proxy_pass http://127.0.0.1:88; include naproxy.conf; }return 301 https://www.$server_name$request_uri;}server {listen 443 ssl; root /www/web/idedecms_com/public_html; server_name idedecms.com idedecms.com www.idedecms.com img.idedecms.mysitecdn.com; index index.html index.php index.htm; error_page 400 /errpage/400.html; error_page 403 /errpage/403.html; error_page 404 /errpage/404.html; error_page 503 /errpage/503.html; location ~ .php$ { proxy_pass http://127.0.0.1:88; include naproxy.conf; } location ~ /.ht { deny all; } location / { try_files $uri @apache; } location @apache { proxy_pass http://127.0.0.1:88; include naproxy.conf; }ssl_certificate /www/ssl/idedecms_com/1_www.idedecms.com_bundle.crt;ssl_certificate_key /www/ssl/idedecms_com/2_www.idedecms.com.key;ssl_session_timeout 5m;}

三、修改链接

下一步,网页加载的 HTTP 资源,网站页面js,css,以及图片资源引用地址改为https。因为加密网页内如果有非加密的资源,浏览器是不会加载那些资源的。

上面这行加载命令,有两种改法。

< script src="https://foo.com/jquery.js">

< !-- 改法二 -->

< script src="//foo.com/jquery.js">

其中,改法二会根据当前网页的协议,加载相同协议的外部资源,更灵活一些。

另外,如果页面头部用到了rel="canonical",也要改成HTTPS网址。

这个不用我说了吧,网站开启https之后,页面上使用http调用的资源都会无法调用。你需要把http的资源全都改成https调用。记住,不能漏掉任何一个js引用或者图片如果有一个文件不是https引用的,则你的网站虽然可以正常https访问,但是地址栏的https标识不会完全变绿,360浏览器尤为明显。这代表你网站虽然启用了https但是没有做到完全的规范。被认定为不规范的https页面。

四、301重定向

下一步,修改 Web 服务器的配置文件,使用 301 重定向,将 HTTP 协议的访问导向 HTTPS 协议。

Nginx 的写法。

server { listen 80; server_name domain.com www.domain.com; return 301 https://domain.com$request_uri;}

Apache 的写法(.htaccess文件)。

RewriteEngine OnRewriteCond %{HTTPS} offRewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值