3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
免費且開放的 Blog 系統,在 PHP 的世界中有 WordPress 稱霸,近幾年興起的 NodeJS 當然也會摻上一腳。Ghost Blog 就是 NodeJS 中較具代表性的 Open Source Blog 專案,在執行效率比起 WordPress,採用 NodeJS 設計的 Ghost 會快上許多。由於 WordPress 已經非常成熟,有非常豐富的外掛 (Plugin) 與樣板 (Theme),很多公司單靠 WordPress 進行客制化就可以吃下不少大案子,但 WordPress 架構吃重資源的問題也是讓人詬病許久,要撐起大流量就必須適當的進行調配。Ghost Blog 雖然沒有 WordPress 來的強大,但是輕量級的架構對於想要快速建構 Blog 的使用者確實蠻吸引人的,其實我也沒有打算轉移到 NodeJS Ghost 陣營的打算,寫這篇文章只是剛好最近研究了 Ghost,順便記錄一下.......哈 安裝 Ghost Blog 如果是要進行開發,建議可以透過 GitHub 直接 Clone 一份下 Source Code 來開發。若是單純安裝來使用,可以直接下載壓縮檔安裝即可,以 Linux 為例安裝步驟如下: mkdir -p /path/ghost cd /path/ghost wget https://ghost.org/zip/ghost-latest.zip unzip ghost-latest.zip rm ghost-latest.zip 安裝前請先安裝 NodeJS 0.10 以上的版本,然後在目錄中透過以下 npm 命令安裝其他相依套件: npm install --production 安裝完成之後先編輯一下 config.js 設定檔,可以調整 Ghost 一些啟動的 port、網址與資料庫等等設定。 vi ./config.js 修改以下區塊,如果要對外記得改 host 與 port (預設是 http://127.0.0.1:2368) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ...   production: {     url: 'http://ghost.toright.com',     mail: {},     database: {         client: 'sqlite3',         connection: {             filename: path.join(__dirname, '/content/data/ghost.db')         },         debug: false     },       server: {         // Host to be passed to node's `net.Server#listen()`         host: '0.0.0.0',         // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`         port: '80'     } },   ... 啟動你的 Ghost Blog 修改好後透過以下命令啟動服務 npm start --production 如果要開機就啟動可以將上述的命令寫到 /etc/rc.local,或者透過以前的教學封裝為 Liunx Service。最後打開瀏覽器輸入網址:http://your.domain/ghost/setup/,就可以看到設定畫面囉,如下: 設定好只後可以登入進到後台,Ghost 算是非常簡潔的系統,採用 MarkDown 進行文章的編輯,畫面如下: 大功告成! 分享到 Twitter(在新視窗中開啟) 按一下以分享至 Facebook(在新視窗中開啟) 分享到 LinkedIn(在新視窗中開啟) 點這裡寄給朋友(在新視窗中開啟) 按一下即可分享至 Skype(在新視窗中開啟) 分享到 Reddit(在新視窗中開啟) 分享到 Tumblr(在新視窗中開啟) 按一下以分享到 Telegram(在新視窗中開啟)

本文由toright提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦