自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何在 Ubuntu 上搭建 Ghost 博客平臺?

系統(tǒng) Linux
Ghost 是一款開源的博客平臺,網(wǎng)上的開源博客程序眾多,去年剛上線的 Ghost 來勢洶洶正迅速捕獲用戶,0.4.1 這么早期的版本就讓 Coding Horror 擁抱了 Ghost。本文分享了在 Ubuntu 上搭建 Ghost 博客平臺的方法。

Ghost 是一款開源的博客平臺,基于 Node.js,由前 WordPress UI 主管 John O’Nolan 和 WordPress 開發(fā)人員 Hannah Wolfe 創(chuàng)立。網(wǎng)上的開源博客程序眾多,去年剛上線的 Ghost 來勢洶洶正迅速捕獲用戶,0.4.1 這么早期的版本就讓 Coding Horror 擁抱了 Ghost。Ghost 主題/模版越來越多,一些優(yōu)秀的 WordPress 主題商,比如 WooThemes 都開始提供 Ghost 主題了。

安裝 Ghost 非常容易,甚至比 WordPress 還簡單。下面的安裝步驟在 Ubuntu 12.04.4 LTS Server 版本上測試通過。

切換到 root 賬號升級和更新整個系統(tǒng):

$ sudo -i

# apt-get update
# apt-get upgrade

安裝 Node.js 運行環(huán)境:

# apt-get install g++ make python python-software-properties
# add-apt-repository ppa:chris-lea/node.js
# apt-get update
# apt-get install nodejs

下載、解壓 Ghost 后安裝:

# cd
# wget https://ghost.org/zip/ghost-0.4.1.zip
# unzip ghost-0.4.1.zip -d ghost
# cd ghost
# npm install --production

配置 Ghost 使其監(jiān)聽本機上的所有 IP,修改 ’127.0.0.1′ 為 ’0.0.0.0′:

# vi config.js
...
       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: '2368'
        }
...

使用 npm 啟動 Ghost 程序:

# npm start

> ghost@0.4.1 start /root/ghost
> node index

Ghost is running in development...
Listening on 0.0.0.0:2368
Url configured as: http://my-ghost-blog.com

Ghost 的默認(rèn)端口是 2366,打開瀏覽器訪問 http://192.168.2.178:2366 就可以看到界面了:

Ghost

 

登錄后臺訪問 http://192.168.2.178:2366/admin 地址:

Ghost

 

Ghost 是獨立程序,在 nodejs 環(huán)境下可以直接運行,在 config.js 文件里修改 Ghost 的監(jiān)聽端口 2366 為 80 就可以了,不過在生產(chǎn)環(huán)境我們一般在前端加個 Nginx.

安裝和配置 Nginx:

# apt-get install nginx
# rm /etc/nginx/sites-enabled/default

# vi /etc/nginx/sites-available/ghost
server {
    listen 0.0.0.0:80;
    server_name vpsee.com;
    access_log /var/log/nginx/vpsee.com.log;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header HOST $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:2368;
        proxy_redirect off;
    }
}

# ln -s /etc/nginx/sites-available/ghost /etc/nginx/sites-enabled/ghost

# /etc/init.d/nginx restart

Nginx 接到請求后會 pass 給(proxy_pass)Ghost 服務(wù)程序,這時候最好把剛才測試用的 Ghost 配置修改還原成 ’127.0.0.1′,修改后記得重啟 Ghost:

# vi config.js
...
            // Host to be passed to node's `net.Server#listen()`
            host: '127.0.0.1',
...

每次 npm start 太麻煩,為了 Ghost 程序在系統(tǒng)啟動后能自動運行,需要加入腳本到 Upstart 里:

# vi /etc/init/ghost.conf
start on startup

script
    cd /root/ghost
    npm start
end script

以后需要啟動、重啟或者停止 Ghost 就可以用 service ghost start/restart/stop 了:

# service ghost restart
ghost stop/waiting
ghost start/running, process 11619

相比 WordPress 的臃腫 Ghost 要輕爽得多。通過 Markdown 格式、Node.js 的實時和漂亮的界面,Ghost 給用戶提供了一種更簡單、更純粹的內(nèi)容寫作發(fā)布方式。左邊是編輯文章,右邊是實時預(yù)覽:

Ghost

責(zé)任編輯:黃丹 來源: vpsee.com
相關(guān)推薦

2016-07-26 13:58:52

Ubuntulinux網(wǎng)橋

2019-08-02 15:30:42

UbuntuMongoDB命令

2019-08-30 11:20:28

UbuntuVirtualBoxLinux

2018-10-15 15:23:50

UbuntupipPython

2024-01-04 11:50:00

UbuntuDocker

2023-08-08 12:38:52

2015-08-04 14:04:28

UbuntuPDF文件

2021-09-11 15:41:55

UbuntuDropbox云服務(wù)

2013-07-25 10:00:30

UbuntuVirtualBox

2017-03-29 16:18:11

LinuxUbuntuRedmine

2019-08-13 16:10:38

UbuntuLinux時間同步

2021-07-12 14:47:16

UbuntuZlib代碼

2015-10-16 10:07:22

Justniffer安裝Ubuntu

2014-06-30 09:27:17

UbuntuTomcat集群

2016-01-15 09:56:44

LinuxUbuntuGlances

2018-09-12 14:30:42

Ubuntu固件命令

2022-05-29 17:37:39

LinuxUbuntuPHP

2018-09-30 10:35:29

UbuntuCinnamon桌面環(huán)境

2018-05-25 11:55:41

2023-11-04 21:40:58

UbuntuLibreOffic
點贊
收藏

51CTO技術(shù)棧公眾號