0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Wordpressサーバー移転メモ

Posted at

Wordpressのサーバー移転をしたときの自分用メモ
もうブログとかいらなくね?と思ったけど、色々やる方が面倒な気がしたので、そのまま移転
PHP7.4から8.2にも変わった

nginxやらPHPは入っている前提。

サーバーの設定

nginxを利用しているので、
旧サーバーにある /etc/nginx/conf.d/***.conf の設定で新サーバーにも立てます。

新サーバー(confの確認・再起動)
sudo nginx -t
service nginx restart

pluginをオフに

Wordpress UI上からオフにします
あんまり考えずに入れ替えたらWordpressのバージョンが古く、結果Yoast SEOのバージョンも古くなり、それがPHP8に対応していませんでした。
オフしてから切り替えましょう

最悪PHP7系も入れて動かすこともできると思いますが、PHP7系はサポート切れてますからね

ファイルの移動

ほんとそのままFTPとかSCPとかで移動すれば良い

local
scp <旧サーバー>:<wordpress置き場所> .
scp ./ <新サーバー>:<wordpress置き場所>

権限つける
つけ忘れても動きますが、パッケージ更新とかが自動でうまくできなくなります
今回はnginxを動かすwww-dataに切り替えましたがパーミッション変える方法とかも有ると思います。

新サーバーの上記データ送ったところ
chown -R www-data <wordpress置き場所>
chgrp -R www-data <wordpress置き場所>

DBデータ移行

旧サーバーにおいてlocalhostに立ててた blog データベースのデーを取得。オプションはなしでも良さそう
この辺のユーザー名とかデータベース名とかは人によって異なるでしょう
DB名などは忘れていても wp-config.php に記載されています

旧サーバー
mysqldump -h localhost -u root -p blog > blog.sql

sqlを新サーバーに送る

local
scp <旧サーバー>:blog.sql .
scp blog.sql <新サーバー>:

ユーザー名なども wp-config.php に記載されています。パスワードも直書きなので変えない場合はそのままでもいけます。
権限はとりあえず全部つけています

新サーバー
mysql -uroot -p
CREATE DATABASE `blog`;
CREATE USER 'blog'@'localhost' IDENTIFIED BY '*******';
GRANT ALL PRIVILEGES ON `blog`.* TO 'blog'@'localhost';

飛んでみる

これでもう動いているはず。
動いていなかったら画面に出ているエラーを見る、nginxのエラーを見るなど

pluginをオン

オンして動作確認して終了です

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?