お世話になっております。
VCCWを使ってWordpressの開発環境を構築してみたのですが、本番データの表示がうまく行かず行き詰まって
しまいました。
<概要>
・mac OS Sierra
・さくらレンタールサーバーに既存wordpressが存在(htmlやcssファイルをthemesにあげて外観を変えただけです。記事の投稿やプラグインの設定はしていません。)
・vagrantやvirtual boxはインストール済み
・ssh公開鍵はmac(ローカル)で鍵作成、サーバーに公開鍵転送、ssh-agentを使って仮想環境でもローカルの鍵でサーバーにssh接続できるよう設定
・VCCWをローカル(mac)にインストール、wordpress Topページは無事表示されました。
・vagrant ssh接続、wordmoveコマンドでpullするも、ローカルipに接続すると「WordPressへようこそ」画面になり、本番サイトが表示されない。
以下行った手順です。
◆ローカル開発環境構築
vccwインストール後
vagrant plugin install vagrant-hostsupdater vagrant box add vccw-team/xenial64 cd vccw vagrant up cp provision / default.yml site.yml
site.ymlは今のところ特に編集していません。
この状態でブラウザにhttp://vccw.test/で接続するとwordpressページ(twentysixteen(初期)テーマ)が表示されました。
◆本番データインストール
Movefileを以下に編集
//localは変更なし //productionを以下に変更 vhost: 本番 url wordpressPass: 本番のファイルパス database: 本番のwp-cinfingと同じに設定 charset:"utf8" を追加 「port: “3308”」と「mysqldump_options: “–max_allowed_packet=50MB”」は削除 ssh host: "さくらレンタルサーバー初期ドメイン名" user: "さくらレンタルサーバーユーザー名"
Vagrant fileにconfiguファイル作成、ローカルと同じ記述
vagrant ssh vagrant@vccw:~/.ssh$ touch config vagrant@vccw:~/.ssh$ vi config vagrant@vccw:~/.ssh$ ssh-add -l //ローカルの鍵が使えるかどうか確認 vagrant@vccw:~/.ssh$ exit vagrant reload vagrant ssh vagrant@vccw:~$ cd /vagrant/ vagrant@vccw:/vagrant$ wordmove pull --all
エラーが出たのはuploads、Mu pluginsとdatabaseです。
uploads / Mu Plugins
rsync: change_dir "/home/ドメイン/www/wordpress/wp-content/uploads" failed: No such file or directory (2) sent 165 bytes received 122 bytes 191.33 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1655) [Receiver=3.1.1]
さくらレンタルサーバーのファイルマネージャーでも確認しましたが、themesにhtmlやcssなどを加えただけで投稿はまだのためか、本番データにも今の所uploadsやMu pluginsはありません。
database
/home/vagrant/.gem/ruby/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/cipher_factory.rb:97: warning: constant OpenSSL::Cipher::Cipher is deprecated /home/vagrant/.gem/ruby/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/cipher_factory.rb:72: warning: constant OpenSSL::Cipher::Cipher is deprecated /home/vagrant/.gem/ruby/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/state.rb:199:in `iv=': iv must be 0 bytes (ArgumentError) from /home/vagrant/.gem/ruby/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/state.rb:199:in `update_next_iv' from /home/vagrant/.gem/ruby/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/state.rb:86:in `final_cipher' from /home/vagrant/.gem/ruby/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/packet_stream.rb:148:in `enqueue_packet' from /home/vagrant/.gem/ruby/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/packet_stream.rb:117:in `send_packet' from /home/vagrant/.gem/ruby/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:241:in `send_message' from /home/vagrant/.gem/ruby/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/authentication/session.rb:57:in `authenticate' from /home/vagrant/.gem/ruby/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:236:in `start' from /home/vagrant/.gem/ruby/2.4.0/gems/photocopier-1.1.1/lib/photocopier/ssh.rb:70:in `session' from /home/vagrant/.gem/ruby/2.4.0/gems/photocopier-1.1.1/lib/photocopier/ssh.rb:43:in `exec!' from /home/vagrant/.gem/ruby/2.4.0/gems/wordmove-2.0.0/lib/wordmove/deployer/ssh.rb:56:in `remote_run' from /home/vagrant/.gem/ruby/2.4.0/gems/wordmove-2.0.0/lib/wordmove/deployer/ssh.rb:67:in `download_remote_db' from /home/vagrant/.gem/ruby/2.4.0/gems/wordmove-2.0.0/lib/wordmove/deployer/ssh.rb:37:in `pull_db' from /home/vagrant/.gem/ruby/2.4.0/gems/wordmove-2.0.0/lib/wordmove/cli.rb:69:in `block in pull' from /home/vagrant/.gem/ruby/2.4.0/gems/wordmove-2.0.0/lib/wordmove/cli.rb:37:in `block in handle_options' from /home/vagrant/.gem/ruby/2.4.0/gems/wordmove-2.0.0/lib/wordmove/cli.rb:36:in `each' from /home/vagrant/.gem/ruby/2.4.0/gems/wordmove-2.0.0/lib/wordmove/cli.rb:36:in `handle_options' from /home/vagrant/.gem/ruby/2.4.0/gems/wordmove-2.0.0/lib/wordmove/cli.rb:68:in `pull' from /home/vagrant/.gem/ruby/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run' from /home/vagrant/.gem/ruby/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command' from /home/vagrant/.gem/ruby/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch' from /home/vagrant/.gem/ruby/2.4.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start' from /home/vagrant/.gem/ruby/2.4.0/gems/wordmove-2.0.0/exe/wordmove:6:in `<top (required)>' from /home/vagrant/.gem/ruby/2.4.0/bin/wordmove:23:in `load' from /home/vagrant/.gem/ruby/2.4.0/bin/wordmove:23:in `<main>'
これはwarningだったのとよくわからなかったこともありそのままにしています、、
ssh接続を抜けて、vagrant reloadするとまず「database接続確立エラー」と表示されました。
・wp-config.phpのtable_prefixがデフォルトのままだったので本番と合わせる
・.htaccessも本番と同じになっていたので、
# BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress
に書き換え
以上でエラーは表示されなくなりましたが、本番のサイトは表示されず、「WordPressへようこそ」のWordPressインストール画面が表示されます。
試しに、wp-config-sample.phpのファイルは消してwp-config.phpのみにしてみたのですが変わりませんでした。
長文になってしまって申し訳ありません。
どなたかご教示いただければと思います。
あなたの回答
tips
プレビュー