Nodebb Environment Construction

Source: Internet
Author: User

[Turn]http://my.oschina.net/bfleeee/blog/268994

Nodebb is a very cool and concise forum system. Based on Nodejs, real-time communication is implemented using Socket.io. The advantage of Socket.io is that it provides a variety of transport implementations as a means of message transmission (supported by Websocket,flash,ajax Long polling, supported browsers Ie5.5+,chrome 4+,firefox Android Webkit,iphone Safari, etc.) and encapsulated as a simple and consistent API for invocation. Nodebb offers highly customizable themes and plug-in systems. Want to do a forum to play, or want to learn Nodejs students can immediately get started.

Sample environment:

CentOS v6.5,node.js v0.10.28, Redis v2.8.9, Nginx v1.6.0

First, the installation base depends on

Install the dependent software first. This is basically a download installation, and each version of Linux can be installed more quickly using its own package manager. Nodebb relies on node. js, and the database uses MONGO or Redis. Here is a redis example.

Installing Nodejs

On the Nodejs download page, select the desired nodejs version to download. Can be used after decompression. Take the 64-bit Linux version as an example:

wget http: //nodejs.org/dist/v0.10.28/node-v0.10.28-linux-x64.tar.gz tar -xzf node-v0. 10.28 -linux-x64.tar.gzFor ease of use, add the bin directory under the node package to/etc/profile and execute the Source: cat << EOF >> /etc/profile PATH=\$PATH:/path/to/node/bin export PATH EOF source /etc/profile

Note that in order to not replace the path variable, "" is used to escape. If you use VI for editing, do not add "".

Installing Redis wget http: //download.redis.io/releases/redis-2.8.9.tar.gz    tar -xvf redis- 2.8 . 9 .tar.gz    cd redis- 2.8 . 9 makeYou can also add Redis commands to path: cat << EOF >> /etc/profile PATH=\$PATH:/path/to/redis/src export PATH EOF source /etc/profile

It is important to note that the source only modifies the environment variables corresponding to the script, and if you want to use the newly changed variables after the execution of the script, you can start the other terminal in the current environment `source /etc/profile .

For security purposes, use Redis plus a password. In redis.conf, add `requirepass password '

To start Redis:

redis-server ./redis.conf

Test Redis:

redis-cli auth passwordSecond, installation Nodebb

Installing Nodebb requires git to clone the code, so install git first:

Install Git

yum install git

Linux is available for git installation in addition to Fedora and other versions of CentOS

Clone Nodebb:

git clone git: //github.com/designcreateplay/NodeBB.git nodebbStart Setup to configure: cd nodebb ./nodebb setupAfter the configuration is complete, start Nodebb: ./nodebb startThird, the use of Nginx agent

Complete the previous step and the installation is basically complete. If there are multiple applications on the server that require 80 ports, you can use Nginx to listen on port 80 to proxy the application.

Installing Nginx wget http: //nginx.org/download/nginx-1.6.0.tar.gz tar -xvf nginx- 1.6 . 0 .tar.gz cd nginx- 1.6 . 0Configure Nginx

In the Nginx directory to modify the conf/nginx.conf, add upstream in HTTP, here is my domain name Haofan.info and port 4567 for example:

upstream nodebb {      server haofan.info: 4567 ; }Create a new configuration file conf/site-enabled/nodebb.conf, as follows: server {      listen       80 ;      server_name haofan.info www.haofan.info;      error_log    logs/nodebb.error.log;      access_log  logs/nodebb.access.log  main;      location / {          root /root/nodebb/ public ;          proxy_set_header X-Real-IP $remote_addr;          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;          proxy_set_header Host $http_host;          proxy_set_header X-NginX-Proxy true ;          proxy_pass http: //nodebb;          proxy_redirect off;          proxy_buffers 8 32k;          proxy_buffer_size 64k;          # Socket.IO Support          proxy_http_version 1.1 ;          proxy_set_header Upgrade $http_upgrade;          proxy_set_header Connection "upgrade" ;      }      error_page   500 502 503 504 /50x.html;      location = /50x.html {      root   html;    } }Modify the conf/nginx.conf file to introduce the configuration file using the Include method: include site-enabled/nodebb.conf;Start Nginx

sbin/nginx

Iv. Appendix: Nodebb and Dependent installation scripts (not including nginx parts): #!/bin/sh export SOFT_DIR=/usr/local/ export NodeBB_PARENT=/root function exist_cmd() {    if hash "$1" 2 >/dev/ null ; then      echo $ 1 ok;      return 1 ;    else      echo $ 1 not ok;      return 0 ;    fi } function install_nodebb() {    cd $NodeBB_PARENT    git clone git: //github.com/designcreateplay/NodeBB.git nodebb    cd nodebb    npm install    ./nodebb setup } exist_cmd node; if [ $? -eq 0 ] ; then    cd $SOFT_DIR    wget http: //nodejs.org/dist/v0.10.28/node-v0.10.28-linux-x64.tar.gz    tar -xzf node-v0. 10.28 -linux-x64.tar.gz    cd node-v0. 10.28 -linux-x64    echo "PATH=\$PATH:`pwd`/bin" >> /etc/profile    echo "export PATH" >> /etc/profile    source /etc/profile; fi exist_cmd redis-server; if [ $? -eq 0 ] ; then    cd $SOFT_DIR    wget http: //download.redis.io/releases/redis-2.8.9.tar.gz    tar -xvf redis- 2.8 . 9 .tar.gz       cd redis- 2.8 . 9    make    echo "PATH=\$PATH:`pwd`/src" >> /etc/profile    echo "export PATH" >> /etc/profile    source /etc/profile    redis-server ./redis.conf fi exist_cmd git; if [ $? -eq 0 ] ; then    yum install git fi if [ -d "$NodeBB_PARENT/nodebb" ] ; then    echo "Exists NodeBB,Delete it ? [yes/no]"    read deleteIt    if [[ $deleteIt == y* ]] ; then      rm -rf $NodeBB_PARENT/nodebb      install_nodebb    fi else    echo "Installing nodebb..."    install_nodebb fi

Nodebb Environment Construction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.