Latest Tweets:

在 heroku 上安裝 wordpress 完整步驟

下載原始碼

  1. wordpress 下載原始碼,並解壓縮

  2. 下載 PostgreSQL for WordPress (PG4WP),並解壓縮

設定資料庫

  1. 打開 postgresql-for-wordpress 資料夾,找到 pg4wp 資料夾整個放到 wordpress/wp-content/ 裡面去

  2. wordpress/wp-content/pg4wp/ 裡面的 db.php copy 到 wordpress/wp-content/

  3. 打開 wordpress/wp-config-sample.php 找到以下這段原始碼

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'database_name_here');
    
    /** MySQL database username */
    define('DB_USER', 'username_here');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'password_here');
    
    /** MySQL hostname */
    define('DB_HOST', 'localhost');
    

    修改為

    // ** MySQL settings - You can get this info from your web host ** //
    $db = parse_url($_ENV["DATABASE_URL"]);
    
    /** The name of the database for WordPress */
    define('DB_NAME', trim($db["path"],'/'));
    
    /** MySQL database username */
    define('DB_USER', $db["user"]);
    
    /** MySQL database password */
    define('DB_PASSWORD', $db["pass"]);
    
    /** MySQL hostname */
    define('DB_HOST', $db["host"]);
    

    並另存為 wordpress/wp-config.php

git 打包

  1. 打開命令列到 wordpress/ 下,git init 專案

    git init
    git add .
    git commit -m "new wordpress"
    

建立 heroku app 並上傳

  1. 打包完,建立 heroku app

    heroku create --stack cedar
    heroku addons:add shared-database:5mb
    
  2. 建立完直接佈署上傳

    git push heroku master
    

這份原始碼可以保留起來,以後想要再開啟另一個 wordpess blog,只要重複最後兩個步驟就行了。


如果你缺少一些工具:

  1. tnwebmaker reblogged this from rgba
  2. rgba posted this