【每日阅读】2020年10月5日-博客从apache转移到nginx以及wordpress转移机器

哈哈,昨天升级到最新版apache后,系统发生了内存泄漏,搞了半天,决定算了,换nginx!下面是一些坑与解决。希望对你有帮助。

wordpress转移机器

我其实是换了台服务器,所以说说怎么给wordpress换机器。

开始我想着用插件,就那个all in one migration,结果它免费最大只能支持512MB的转移。也只能作罢。

最后选择暴力转移,就是:

  1. 把整个wordpress目录打包压缩!复制到新机器(只要注意wp-config.php内的数据库配置修改正确即可)
  2. 从老机器导出整个wordpress数据库到一个sql文件,然后在新机器导入

最终,就这么解决啦!

nginx配置

我把我整个nginx配置文件贴在这里

其中rewrite解析见我的另一篇博文:

server {
    listen 443 ssl;
    server_tokens off;
    keepalive_timeout 5;

    server_name geekgao.cn;

    root wordpress绝对路径;
    index index.php;

    access_log logs/wordpress.log combinediox;
    error_log logs/wordpress.error.log;

    ssl_certificate https证书绝对路径.pem;
    ssl_certificate_key https密钥绝对路径.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";

    location / {
        if (-f $request_filename/index.php){
            rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
            rewrite (.*) /index.php;
        }
    }

    location ~* \.php$ {
        fastcgi_pass   127.0.0.1:9000;

        include fastcgi.conf;

        client_max_body_size 20m;
        fastcgi_connect_timeout 30s;
        fastcgi_send_timeout 30s;
        fastcgi_read_timeout 30s;
        fastcgi_intercept_errors on;
    }
}

http跳转https

只要在http的模块内这样配置即可

server {
    listen       80;
    server_name  geekgao.cn;
    return 301 https://$host$request_uri;
}

原创文章,作者:geekgao,如若转载,请注明出处:https://www.geekgao.cn/archives/2535

(0)
geekgaogeekgao博主
上一篇 2020年10月5日 上午1:05
下一篇 2020年10月6日 下午10:12

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

GitHub
分享本页
返回顶部

Warning: error_log(/usr/local/lighthouse/softwares/wordpress/wp-content/plugins/spider-analyser/#log/log-2617.txt): failed to open stream: No such file or directory in /usr/local/lighthouse/softwares/wordpress/wp-content/plugins/spider-analyser/spider.class.php on line 2900