现在越来越多的网站开始使用https协议,其实百度从2014年底就已经开始支持https了,并且据说在排名上,同权重的网站,开启https会优待提升排名。先不管排不排名吧,https是一种更安全更先进的技术。作为互联网的弄潮儿,我们必须要与时俱进呀~果断的,全站启用https协议。下面具体说一下https的开启步骤:
一,申请SSL证书
有些小白会以为开启https只是在网址http后面加个s就可以了,其实不是的。https是需要验证SSL证书的,如果没有证书或者证书不匹配,则通过https访问你的网站是会被浏览器拦截的。

ssl证书是开启https的必要前提,证书有付费的,有免费的,腾讯云阿里云等各大云服务商都有提供免费的ssl证书。下面举腾讯云的例子:
1.注册腾讯云
http://partners.qcloud.com/invitation/996681198582ad35c39528
2.关联我司作为服务商(非必要条件,友情关联)

3.申请SSL证书
https://console.qcloud.com/ssl





二,上传SSL证书到服务器
腾讯云面板下载的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;
}
(把配置文件代码贴出来貌似也无妨,别黑我们服务器哈哈哈哈哈哈哈哈哈哈哈哈)
四,网站页面js,css,以及图片资源引用地址改为https
这个不用我说了吧,网站开启https之后,页面上使用http调用的资源都会无法调用。
你需要把http的资源全都改成https调用。记住,不能漏掉任何一个js引用或者图片
如果有一个文件不是https引用的,则你的网站虽然可以正常https访问,但是地址栏
的https标识不会完全变绿,360浏览器尤为明显。这代表你网站虽然启用了https
但是没有做到完全的规范。被认定为不规范的https页面。
图一,规范的https页面,里面的资源全部使用https调用。

图二,不规范的https页面,里面的部分资未使用https调用。
