zoukankan      html  css  js  c++  java
  • WORDPRESS改为https部署

    1.确保你已经正确开启了httpd 2.4.6的https配置,并且配置了该网站的虚拟主机,如下所示:

    <VirtualHost *:443>
       DocumentRoot "/appvol/wordpress_blog"
       ServerName robin.org.cn
       ServerAlias www.robin.org.cn
       AddType text/html .php
       <Directory "/appvol/wordpress_blog">
          Options FollowSymLinks
          AllowOverride All
          Require all granted
        </Directory>
    </VirtualHost>
    <VirtualHost *:80>
        DocumentRoot "/appvol/wordpress_blog"
        ServerName robin.org.cn
        ServerAlias www.robin.org.cn
        AddType text/html .php
    
        #对于80端口开启RUL重定向
        RewriteEngine on
        RewriteCond %{HTTPS} !=on
        RewriteRule ^(.*) https://%{SERVER_NAME}$1 [L,R] 
     
        <Directory "/appvol/wordpress_blog">
          Options FollowSymLinks
          AllowOverride All
          Require all granted
        </Directory>
    </VirtualHost>

    2.配置wordpress站点配置文件

    在* @package WordPress后面添加如下配置:
    //added at 2019.1.23
       $_SERVER['HTTPS'] = 'on';
       define('FORCE_SSL_LOGIN', true);
      define('FORCE_SSL_ADMIN', true);

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');

    前面添加如下配置,如果已经存在,确保http已经修改为https:

    //added at 2019.1.19
    $yovisunhome = 'https://'.$_SERVER['HTTP_HOST'];
    $yovisunsiteurl = 'https://'.$_SERVER['HTTP_HOST'];
    define('WP_HOME', $yovisunhome);
    define('WP_SITEURL', $yovisunsiteurl);

    3.重启httpd

    service httpd restart

    如果您喜欢我,可以通过微信请我喝果汁。

    如果有疑问,可以留言或者发邮件给我 lhh_nj@163.com
  • 相关阅读:
    周末小练习
    第十二届全国大学生信息安全竞赛总结与反思
    sql注入学习心得与sqlmap使用心得
    2019“嘉韦思”杯RSA256题目wp
    斐波那契数列求解的三种方法
    二叉树的下一个节点
    替换空格
    二维数组中的查找
    不修改数组找出重复数字
    数组中重复数字
  • 原文地址:https://www.cnblogs.com/lihuanhuan/p/10612104.html
Copyright © 2011-2022 走看看