CentOS6.5安装部署Nodeclub


  • administrators

    GitHub上是这样写的

    线上跑的是 Node.js v4.4.0,MongoDB 是 v3.0.5,Redis 是 v3.0.3。

    1. 安装 `Node.js/io.js[必须]` `MongoDB[必须]` `Redis[必须]`
    2. 启动 MongoDB 和 Redis
    3. `$ make install` 安装 Nodeclub 的依赖包
    4. `cp config.default.js config.js` 请根据需要修改配置文件
    5. `$ make test` 确保各项服务都正常
    6. `$ node app.js`
    7. visit `http://localhost:3000`
    8. done!
    

    前面准备工作已经做完,现在git一份源码吧

    [root@li1473-187 ~]# git --version
    git version 1.7.1
    [root@li1473-187 ~]# git clone https://github.com/cnodejs/nodeclub.git
    Initialized empty Git repository in /root/nodeclub/nodeclub/.git/
    remote: Counting objects: 10273, done.
    remote: Total 10273 (delta 0), reused 0 (delta 0), pack-reused 10273
    Receiving objects: 100% (10273/10273), 9.01 MiB | 3.35 MiB/s, done.
    Resolving deltas: 100% (6639/6639), done.
    [root@li1473-187 ~]# ls
    nodeclub
    [root@li1473-187 ~]# mv nodeclub /home/wwwroot/
    [root@li1473-187 ~# cd /home/wwwroot/
    [root@li1473-187 wwwroot]# ls
    default  ghost  Ghost-0.7.4-zh-full.zip  ghost1  nodeclub  testweb  wordpress-4.7.2-zh_CN.tar.gz
    [root@li1473-187 wwwroot]# cd nodeclub
    [root@li1473-187 nodeclub]# cp config.default.js config.js
    [root@li1473-187 nodeclub]# vim config.js
    [root@li1473-187 nodeclub]# make install
    warn不要紧
    [root@li1473-187 nodeclub]# node app.js
    [2017-02-15 20:37:25.587] [INFO] cheese - NodeClub listening on port 3000
    [2017-02-15 20:37:25.588] [INFO] cheese - God bless love....
    [2017-02-15 20:37:25.589] [INFO] cheese - You can debug your app with http://localhost:3000
    [2017-02-15 20:37:25.589] [INFO] cheese -
    

    成功启动。

    配置Nginx

    [root@li1473-187 ~]# cd /usr/local/nginx/conf/vhost
    [root@li1473-187 vhost]# ls
    ghost.kokwind.net.conf  test.kokwind.net.conf
    [root@li1473-187 vhost]# cp ghost.kokwind.net.conf club.kokwind.net
    [root@li1473-187 vhost]# vim club.kokwind.net
    server
     {
     listen 80;
     #listen [::]:80;
     server_name club.kokwind.net;
     index index.html index.htm index.php default.html default.htm default.php;
     root /home/wwwroot/nodeclub;
    
     include none.conf;
     #error_page 404 /404.html;
     include enable-php.conf;
    
     location / {
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header Host $http_host;
     proxy_pass http://localhost:3000;
     proxy_set_header REMOTE-HOST $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     }
     access_log /home/wwwlogs/nodeclub.log;
     }
    [root@li1473-187 vhost]# /etc/init.d/nginx reload
    Reload service nginx... done
    [root@li1473-187 vhost]# cd /home/wwwroot/nodeclub/
    [root@li1473-187 nodeclub]#
    

    使用pm2启动,pm2安装使用参考这里

    [root@li1473-187 nodeclub]# pm2 start app.js
    [PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
    [PM2] PM2 Successfully daemonized
    [PM2] Starting /home/wwwroot/nodeclub/app.js in fork_mode (1 instance)
    [PM2] Done.
    ┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────┬───────────┬──────────┐
    │ App name │ id │ mode │ pid  │ status │ restart │ uptime │ cpu │ mem       │ watching │
    ├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────┼───────────┼──────────┤
    │ app      │ 0  │ fork │ 5431 │ online │ 0       │ 0s     │ 0%  │ 10.5 MB   │ disabled │
    └──────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────┴───────────┴──────────┘
     Use `pm2 show <id|name>` to get more details about an app
    [root@li1473-187 nodeclub]#
    

    打开网址


Log in to reply
 

Looks like your connection to MainFrame was lost, please wait while we try to reconnect.