如何把网站升级到Https协议下
作为一个技术发烧友,阿文怎么能容忍自己的网站不是https的呢?今天就来整一下。环境
腾讯云服务器,Centos7系统。申请证书
控制台很方便能申请,证书要和域名绑定。
证书拿到后下载下来,目录结构长这样。〔rootVM2412centoswordpress443〕treecertcertApache1rootbundle。crt2www。ruanwenwu。com。cn。crt3www。ruanwenwu。com。cn。keyIISkeystorePass。txtwww。ruanwenwu。com。cn。pfxNginx1www。ruanwenwu。com。cnbundle。crt2www。ruanwenwu。com。cn。keyTomcatkeystorePass。txtwww。ruanwenwu。com。cn。jkswww。ruanwenwu。com。cn。csrwww。ruanwenwu。com。cn。keywww。ruanwenwu。com。cn。pem
我们用到的只有www。ruanwenwu。com。cn。key和Nginx目录下的1www。ruanwenwu。com。cnbundle。crt。配置nginx服务httpsserver{listen443ssl;servernamewww。ruanwenwu。com。cn;sslcertificateconf。dcertNginx1www。ruanwenwu。com。cnbundle。crt;请填写私钥文件的相对路径或绝对路径sslcertificatekeyconf。dcertwww。ruanwenwu。com。cn。key;sslsessiontimeout5m;请按照以下协议配置sslprotocolsTLSv1。2TLSv1。3;请按照以下套件配置,配置加密套件,写法遵循openssl标准。sslciphersECDHERSAAES128GCMSHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;sslpreferservercipherson;location{rootusrsharenginxhtml;indexindex。htmlindex。htmindex。php;}errorpage50050250350450x。html;location50x。html{rootusrsharenginxhtml;}location。php{fastcgipassphp:9000;fastcgiindexindex。php;fastcgiparamSCRIPTFILENAMEwwwwordpressfastcgiscriptname;includefastcgiparams;}location(imagesimgjavascriptjscssvueflashmediastatic){autoindexon;accesslogoff;expires30d;}}http服务server{listen80;servernameruanwenwu。com。cn;return301https:hostrequesturi;}
http访问做301到htts。到此就大功告成了。
发布于