##Ubuntu Server
sudo apt-get install g++ curl libssl-dev apache2-utils git-core make
cd /usr/local/src
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz
tar -xvzf node-v0.10.28.tar.gz
cd node-v0.10.28
./configure
make
sudo make install
Now check for NodeJS and NPM versions
node --version
npm --version
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-org
Then Start Mondgo DB Service
sudo /etc/init.d/mongod start
Check if it has executed correctly
vim /var/log/mongodb/mongod.log
it could take a while .. mongo preallocates 3.0gb so wait for message like:
2014-05-24T03:12:17.599+0000 [initandlisten] waiting for connections on port 27017
To Run a client of mongodb and see current DBs
$ mongo
> show dbs
mkdir -p /var/www/
cd /var/www/
git clone https://github.com/user/project-name.git
cd project-name/
npm install --production
Now copy the template config.json and configure
cp config.env.json.sample config.prod.json
vim config.prod.json
Install Forever Globally to run nodejs
npm install -g forever
Run NodeJS Process at production
environment on port 5000
NODE_ENV=production PORT=5000 forever start ./bin/www
Check if process is runing and log
forever list
forever logs 0
sudo apt-get install nginx
sudo service nginx start
Configure the NodeJS Process
vim /etc/nginx/sites-enabled/default
Add the following lines after location / {
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://localhost:5000/;
proxy_redirect off;
Then restart NGINX:
sudo service nginx restart
Now go to your browser and put the http://SERVER-IP
I'm having this error:
sudo: /etc/init.d/mongod: command not found
Any ideas?