LoginSignup
0

More than 1 year has passed since last update.

EC-CUBE4のサーバー引っ越し

Posted at

自分のための忘備録です。


①ファイルを固める

まずsshでサーバーに入って、EC-CUBEファイルを丸ごとtarで固めます。
varディレクトリ内のキャッシュファイル、ログファイル、セッションのファイルはエラーの原因になるので削除した方がいいそうです。

ssh ユーザー名@ドメイン
tar zcvfp eccube.tar.gz --exclude public_html/eccube/var/cache/ --exclude public_html/eccube/var/log/ --exclude public_html/eccube/var/sessions/  public_html/eccube

tarのオプション

tar
z gzの圧縮・解凍(cと組み合わせで圧縮、xと組み合わせで解凍)
x アーカイブの展開
v 中身の表示
p アーカイブされたときのパーミッションを再現
-f アーカイブファイル名の指定(省略時は/dev/rmt0)
-C チェンジディレクトリする

②.tar.gzファイルのダウンロード

sshから出て、.tar.gzファイルをデスクトップにダウンロードします。

exit
scp ユーザ名@ホスト名:/home/user/public_html/eccube.tar.gz ~/Desktop/

③アップロード、展開

引っ越し先のサーバーにアップロードしてsshで入り、展開します。

scp ~/Desktop/eccube.tar.gz ユーザ名@引っ越し先のホスト名:/home/user/public_html/
ssh ユーザー名@ドメイン
cd public_html
tar zxvfp eccube.tar.gz

必要があれば展開後ファイルを移動する

//一つ上に移動
mv * ../
//もし隠しファイルがあればそれも移動
mv .[^\.]* ../

④設定ファイルを書き換える

EC-CUBE4の場合、設定情報は .envファイルか .htaccessらしいです。
これは.envファイルの例

DATABASE_URL=mysql://username:password@host/database
・
・
DATABASE_SERVER_VERSION=5.7.27```
・
・
MAILER_URL=sendmail://localhost
・
・
ECCUBE_COOKIE_PATH=/

⑤引っ越し先のサーバーにデータベースをコピーする。

phpMyAdminで元サーバーからエクスポート、引っ越し先サーバーでインポートする。

終わり。


ちょっと関係ないんですが、eccubeがおかしくなりました。
php7.3じゃないとおかしくなるみたいです。

php.cgiを使ってなんとかしました。


参考しました
https://qiita.com/seiyaan/items/0708ebb6e24f2863adb2
https://techmemo.biz/ec-cube/eccube4-server-migration/

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