I created a droplet on digital ocean to serve this project. The parameter of the server is:
I will list some memos for the deployment process for future reference.
sudo apt-get update
sudo apt-get install -y build-essential openssl libssl-dev pkg-config
sudo apt-get install node
sudo apt-get install npm
sudo npm cache clean -f
sudo npm install -g n
sudo n stable (or whichever node version you want e.g. 5.9.0)
sudo apt-get install nginx
sudo apt-get install git
sudo mkdir /var/www
cd /var/www
sudo git clone
cd /etc/nginx/sites-available
sudo vim
server {
listen 80;
location / {
proxy_pass http://:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
This code says: have the reverse proxy server (nginx) listen at port 80. When going to root /, listen for http requests as though you were actually http:// your private ip and the port your server is listening e.g @8000 or @6789 etc.
cd /etc/nginx/sites-available
sudo rm default
sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
cd /etc/nginx/sites-enabled/
sudo rm default
sudo npm install pm2 -g
pm2 start server.js
pm2 stop 0
pm2 restart 0
sudo service nginx reload && sudo service nginx restart
npm install
sudo npm install bower -g
sudo bower install --allow-root
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
pm2 stop 0
pm2 restart 0
sudo service nginx reload && sudo service nginx restart
At this point, all the works are done. The project is on live.