2019年8月17日土曜日

heroku for Wordpress

1)wordpressをローカルにダウンロードする。
curl -sS https://wordpress.org/latest.zip > wordpress.zip
unzip wordpress.zip
cd wordpress

2)初期化を行う。
git init
git add .

3)gitに登録する
git commit -m "最初のコミット"

4)wrodpressのconfigの変更を行う。
mv wp-config-sample.php wp-config.php
vi wp-config.php

 =====以下、編集箇所=================================

<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://codex.wordpress.org/Editing_wp-config.php
 *
 * @package WordPress
 */


$url = parse_url(getenv('CLEARDB_DATABASE_URL'));

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', trim($url['path'], '/'));

/** MySQL database username */
define( 'DB_USER', $url['user']);

/** MySQL database password */
define( 'DB_PASSWORD', $url['pass']);

/** MySQL hostname */
define( 'DB_HOST', $url['host']);

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
=======ここまで=================================


5)gitのファイル登録を行う。
git add .
git commit -m "wp-configにDB接続情報を書き込み"


6)herokuのアプリとして作成を行う。
heroku create digihide-wordpress-site


7)以下を行わないと、DBの作成ができないので注意すること。
heroku git:remote -a digihide-wordpress-site


8)DBの作成を行う。
heroku addons:add cleardb:ignite

git push heroku master


9)以下で、wordpressが作成できるころが確認できるはず。
heroku open



<修正する場合>
vi wp-config.php 
git add .
git push heroku master



0 件のコメント:

コメントを投稿

メモ

 find フォルダー名 -type f -exec sed -i 's/\/FKP/\/WEB\/FKP/g' {} +