Install Node.js
Try to boot Node.js after install it and set nginx config file.First is installing Node.js.
# Install pythonbrew $ curl -kL http://xrl.us/pythonbrewinstall | bash $ vim ~/.bashrc $ \[\[ -s $HOME/.pythonbrew/etc/bashrc \]\] && source $HOME/.pythonbrew/etc/bashrc $ source ~/.bashrc $ pythonbrew install 2.7.2 $ pythonbrew switch 2.7.2 #Install node.js $ git clone git://github.com/creationix/nvm.git ~/.nvm $ source ~/.nvm/nvm.sh $ nvm install v0.8.7 $ vim ~/.bashrc source ~/.nvm/nvm.sh nvm use v0.8.7 $ source ~/.bashrc
Please delete back slash at “[[ -s $HOME/.pythonbrew/etc/bashrc ]]”. If you got like “Can not get Stable Version”,
please do following commands instead of above installing pythonbrew part.
# Install pythonbrew $ curl -kL http://xrl.us/pythonbrewinstall > pythonbrewinstaller.sh $ vim pythonbrewinstaller.sh STABLE_VERSION=`$CURL -sL${CURL_ADDITIONAL_PARAMETERS} https://github.com/utahta/pythonbrew/raw/master/stable-version.txt` STABLE_VERSION=`trim $STABLE_VERSION` if [[ -z "$STABLE_VERSION" ]] ; then echo 'Can not get stable-version of pythonbrew.' exit 1 fi => #STABLE_VERSION=`$CURL -sL${CURL_ADDITIONAL_PARAMETERS} https://github.com/utahta/pythonbrew/raw/master/stable-version.txt` #STABLE_VERSION=`trim $STABLE_VERSION` #if [[ -z "$STABLE_VERSION" ]] ; then # echo 'Can not get stable-version of pythonbrew.' # exit 1 #fi STABLE_VERSION='1.3.4' -------- builtin cd $PATH_DISTS ; $CURL --progress-bar -L${CURL_ADDITIONAL_PARAMETERS} $DOWNLOAD_URL -o "$TEMP_TARBALL" => builtin cd $PATH_DISTS ; $CURL --progress-bar -kL${CURL_ADDITIONAL_PARAMETERS} $DOWNLOAD_URL -o "$TEMP_TARBALL" $ vim ~/.bashrc $ \[\[ -s $HOME/.pythonbrew/etc/bashrc \]\] && source $HOME/.pythonbrew/etc/bashrc $ source ~/.bashrc $ pythonbrew install 2.7.2 $ pythonbrew switch 2.7.2
Boot Node.js
Next is setting nginx config file.Next is writing js to boot it on Node.js.server { listen 80; server_name (IP addr or Server name); access_log (logpath); error_log (logpath); location / { proxy_pass http://localhost:8080/; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; }
Access the web page with following command and then it’s OK that “Hello World” is shown !var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(8080, '127.0.0.1'); console.log('Server running at http://127.0.0.1:8080/');
$ node sample.js