Wong's Blog

Always on the way forward
  1. 首页
  2. 其他
  3. 正文

WordPress强制HTTPS

2023 年 3 月 22 日 98点热度 0条评论

目前,如果网站不是https连接,被搜索引擎收录会被降权,浏览器也会提示不安全,以下是强制启用https链接方法。

一、申请证书

可以在云服务提供商,阿里云,cloudflare等服务商申请免费证书,一般是key、pem、crt结尾

二、配置nginx

server
   {
     listen 80;
     server_name  www.xxxx.com;
     return  301 https://www.xxx.com$request_uri;
   }
server
   {
   listen 443;
   server_name www.xxx.com
   ssl_certificate  /usr/local.....      //证书路径
   ssl_certificate_key   /usr/local....  //证书路径
   index  index.html  index.htm  index.php
   root  /home/.....                      //网站目录
   }

三、WorePress后台设置

设置-通用配置

WordPress地址(url): http --> https

站点地址(url): http --> https

标签: 暂无
最后更新:2023 年 3 月 22 日

wong

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复
  • Linux / 6篇
  • Macos / 7篇
  • Windows / 9篇
  • 其他 / 9篇

在路上 | 2024