侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130560 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

用aliyun ecs部署ghost bolg(精简版)

2023-12-21 星期四 / 0 评论 / 0 点赞 / 76 阅读 / 2387 字

1、 安装配置 nodejswget http://nodejs.org/dist/v4.2.6/node-v4.2.6-linux-x64.tar.gztar zxvf node-v4.2.6-li

1、 安装配置 nodejs

wget http://nodejs.org/dist/v4.2.6/node-v4.2.6-linux-x64.tar.gztar zxvf node-v4.2.6-linux-x64.tar.gz

输入命令:vim /etc/profile(如果没有安装vim,可根据提示安装,vim比vi好用多了),在末尾添加以下三行:

export NODE_HOME=/root/node-v4.2.6-linux-x64export PATH=$PATH:$NODE_HOME/bin export NODE_PATH=$NODE_HOME/lib/node_modules

之后按Esc键,并输入“:wq!”命令保存配置并推出

在命令行输入:source /etc/profile,然后在命令行输入:node -v,返回版本信息v4.2.6,说明环境变量配置就生效了;但,你会发现进入root账户,改配置并没有生效

在命令行输入:vim /root/.bashrc,并在文件末尾加入一行source /etc/profile命令,保存。这样就大功告成了。安装cnpm 建议使用淘宝镜像安装,否则会很慢的

$ npm install -g cnpm --registry=https://registry.npm.taobao.org  

**2、安装ghost**

cd /var/www  wget http://dl.ghostchina.com/Ghost-0.7.4-zh-full.zip  unzip Ghost-0.7.4-zh-full.zip -d ghost  cd ghost  

接着修改默认配置:

Bash

cp config.example.js config.js  vi config.js  

Ghost有产品模式、开发模式和测试模式等多种运行模式,这里我们需要在配置文件中找到production模式:

生产模式

production: {      url: 'http://www.abc.com', # 修改为你的域名或者IP,注意加上http://    mail: {},    database: {        client: 'mysql'        connection: {            host     : '127.0.0.1',            user     : 'ghost', # 数据库连接的用户            password : '123456', # 先前创建的密码            database : 'ghost', # 先前创建的数据库            charset  : 'utf8'        },    server: {            host: '127.0.0.1',            port: '2368' # 若修改该端口记得在nginx中做相应改变        }    }  

保存退出,接下来就到了见证奇迹的时刻啦,输入指令:

Bash

npm start --production  

启动浏览器,输入之前配置的域名或者IP,我们就可以看到建立好的Ghost博客啦。 (Ctrl+C 中断掉开发者模式)

广告 广告

评论区